question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Override snackbar :host styles

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the expected behavior?

I add extraClasses: ['errorSnackBar'] to my snackbar config in order to override the styles of the container. I should be able to change the background color. The only way I can get around it is by adding !important to everything and thats no bueno.

What is the current behavior?

My class is added properly but background color is overwritten by the :host styles in the snack-bar-container

What are the steps to reproduce?

Try to change the background color. PLNKR Link. The background: blue is overridden.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
JDillon522commented, May 2, 2017

@theKush I just had to be more specific in my styling. I was trying to add error and success type classes. This is what I ended up doing:

snack-bar-container {
    &.errorSnackBar, &.successSnackBar {
        height: auto; 
        min-width: initial;
    }

    &.errorSnackBar {
        background: mat-color($rp-warn, 400);
    }   
 
    &.successSnackBar {        
        background: mat-color($rp-accent, 400);
    }
 
    .mat-simple-snackbar .mat-simple-snackbar-message {
        white-space: normal; 
        font-size: 16px;
        font-weight: bold;
    }
}
0reactions
angular-automatic-lock-bot[bot]commented, Sep 6, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override snackbar :host styles · Issue #4201 - GitHub
I add extraClasses: ['errorSnackBar'] to my snackbar config in order to override the styles of the container. I should be able to change...
Read more >
CSS : Angular Material Overriding Default Style of SnackBar ...
CSS : Angular Material Overriding Default Style of SnackBar Component [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
Configuring Snackbar in Jetpack Compose when using ...
This is how the Snackbar would show once everything is setup and working, above the bottom navigation bar. scaffoldState. snackbarHostState.
Read more >
Angular Material Overriding Default Style of SnackBar ...
Save this question. Show activity on this post. I am attempting to override the default max-width of the snackbar component in Angular Material....
Read more >
SnackbarHostState - Android Developers
decouple snackbar host state from scaffold state for demo purposes ... To change the Snackbar appearance, change it in 'snackbarHost' on the Scaffold...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found