[Toast] Extend toast behavior with theme
See original GitHub issueDescription
I’d like to have a default behavior for toast (position, duration, isClosable, etc). Currently, the way to go about it is to create a custom hook.
I’d like to extend it within the theme if possible.
Problem Statement/Justification
I think the DX for this is cleaner than maintaining my own custom useToast
hook.
Proposed Solution or API
export const theme = extendTheme(
{
components: {
useToast: {
defaultProps: {
position: "bottom-right",
},
},
},
},
);
Alternatives
No response
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Toasts - Bootstrap
Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. Toasts are lightweight notifications designed to mimic ...
Read more >Toasts overview - Android Developers
A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message...
Read more >Toast Notification Timing Adjustable · Issue #6270 - GitHub
Expected Behavior Toasts need to support a way to extend timing or set a new ... Behavior Currently the time limit is controlled...
Read more >How to style | React-Toastify - GitHub Pages
Used to define container behavior: width, position: fixed etc... **/ .Toastify__toast-container {. } /** Used to define the position of the ToastContainer ......
Read more >How to generate a toast when processing assignment in ...
In Theme-Cosmos, a toast is displayed only when creating a new case ... This behavior can be configured in the Cosmos UI setting...
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
Thanks, @segunadebayo, sounds like a fair decision 👍
For anyone that comes across this, I ended up writing a wrapper that looks like this:
I totally understand that this is a feature that sounds nice. I believe this can be resolved on your end by creating a wrapper around
useToast
.From an API design perspective, I don’t think it’s a good idea to add this. I know you might disagree, but that’s okay.
In the upcoming changes to the toast component, we intend to add a global toast provider to configure this from the ChakraProvider directly instead of adding that to the theme.
Thanks for understanding.