How to style different toast types globally ?
See original GitHub issue` // Verification email sent if (status === ‘checkMail’) { toast.success(‘Please check your email’, { className: { color: ‘#343a40’, minHeight: ‘60px’, borderRadius: ‘8px’, background: ‘#2FEDAD’, boxShadow: ‘2px 2px 20px 2px rgba(0,0,0,0.3)’ }, progressClassName: css({ background: ‘#007aff’ }) }); }
// Verification Success
if (status === 'emailVerified') {
toast.success('Thankyou, your email has been verified!', {
className: {
color: '#343a40',
minHeight: '60px',
borderRadius: '8px',
background: '#2FEDAD',
boxShadow: '2px 2px 20px 2px rgba(0,0,0,0.3)'
},
progressClassName: css({
background: '#007aff'
})
});
}
// password updated
if (status === 'passwordUpdated') {
toast.success('Password has been updated!', {
className: {
color: '#343a40',
minHeight: '60px',
borderRadius: '8px',
background: '#2FEDAD',
boxShadow: '2px 2px 20px 2px rgba(0,0,0,0.3)'
},
progressClassName: css({
background: '#007aff'
})
});
}
// --------- Signup Fail Toaster
if (status === 'signupFail') {
toast.error('User Already Exists!', {
className: {
color: '#fff',
minHeight: '60px',
borderRadius: '8px',
boxShadow: '2px 2px 20px 2px rgba(0,0,0,0.3)'
},
progressClassName: css({
background: '#007aff'
})
});
}
// --------- Login Fail Toaster
if (status === 'fail') {
toast.error('Wrong User name and password!', {
className: {
color: '#fff',
minHeight: '60px',
borderRadius: '8px',
boxShadow: '2px 2px 20px 2px rgba(0,0,0,0.3)'
},
progressClassName: css({
background: '#007aff'
})
});
}`
As you can see i have multiple toasters maily two types. one is success toaster and another is error. both types of toaster have same css i.e., all success toasters have same css and all error toasters share same css. how do i define global css for both type ? or how can i declare global css for different toaster types on <ToastContainer/>. I dont want to manage my css from style.css or any css file.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to style | React-Toastify - GitHub Pages
Below, a list of the CSS classes used(classes used for animation and media query are omitted) ... The ToastContainer accept the following props...
Read more >Using React-Toastify to style your toast messages
Styling your toast messages with React-Toastify ... This technique uses different colors for each toast message type to make it easier for ...
Read more >How can I change the styles of the react-toastify popup ...
Easest way to define a custom method, which can take the type of notification, content, and toast options.
Read more >What people put on their toast in 10 countries around the world
What people put on their toast in 10 countries around the world · France is well-known for mastering the simple toast. · In...
Read more >Toasts · Bootstrap v5.0
You can stack toasts by wrapping them in a toast container, which will vertically add some spacing. Bootstrap just now. See? Just like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @sushmit-oodles,
It can be done easily with your own implementation as follow:
Cheers
@fkhadra could you attach a snippet as well cause the link to sandbox is broken? I believe this is a very common question but it’s not covered in docs.