-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add a custom class without replacing 'toast'? #594
Comments
In CSS you can add your own |
@yarrgh Thanks, but that would apply to all my toasts. I'm wondering if I can target one specific toast (that is displaying HTML content) without affecting other toasts and without having to copy all the styles that are attached to the toast class. |
I 2nd this. it would be very convenient to simply add styling in addition to the defaults. Copying all styles to a custom class still introduces errors for me such as the onTap and onAction events no longer firing |
This is a much-needed feature. if there is any other way please let me know. Thank you |
put |
@scttcper Thank you for the quick reply. I tried adding my class with the property of However, if I use Can you please suggest how can I use it in the correct manner. Thank you very much in advance :) |
i had success by being more specific with the classes. could also try !important. .yourclass.toast-success {
background-color: blue;
} |
Thank you very much 👍 I have this working with the css you provided and then specifying As you can see I had to use both One more quick question, please. I have to put my class in styles.css. I would want to move it to the component level css file, its the place I am calling Once again thank you for the help! |
the toast is not inside the context of your component so scoped css would not be applied. custom toasts would be the closest you could get but would still require positioning styles applied globally |
Is there any way I can change the position of the toastr from within a component? I see the toastClass gets applied to the content, not the container. |
This worked like charm. |
I can't get this to work, I am trying this in my .ts file
In the same dir, I have an css file
I don't see it blue, am I doing smth wrong? |
🎉 This issue has been resolved in version 16.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
node_modules/ngx-toastr/toastr/toast.directive.d.ts:8:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments. |
My requirement is to show a countdown timer in the toastr message, is there any way to do this? |
.yourclass.toast-error{ |
If you'd like to apply a custom style (e.g., a background color) to all your toastr messages, follow these steps:
and in the styles.scss
But if you want to only change the background color for the "info" toastr messages while keeping other toastr types (success, warning, error) unchanged, follow these steps:
|
exactly what I needed! Thanks @marjanjavid 🥇 |
Sorry if this is answered somewhere, but I want to add some custom styles to an individual toast popup (e.g. increase width). I see the
toastClass
config option - but this replaces thetoast
class which has essential styles applied to it (from bootstrap styles).Is the only way to copy all the styles attached to
.toast
into my own custom class?The text was updated successfully, but these errors were encountered: