-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
feat(toast): expose Toast wrapper style prop for override #4922
Conversation
🦋 Changeset detectedLatest commit: 84b91a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). chakra-ui – ./🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui/H2nJaw9FGPiJ7VH1qn4MCcVwjo3x chakra-ui-storybook – ./🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/CgQeZozPyvuKds7qGxUujdhyNw94 |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
+1 for this, overriding styles of toast is very useful. |
+2 :D are you guys planning to merge this soon? thanks! |
+3, really appreciate it if this can be merged soon. Currently I'm using If this get merged I can remove that package and use chakra-ui's toast instead (reducing additional package needed just for toast customization) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @karrui. Some feedback to get this merged:
- Please rename all instances of
wrapperStyle
tocontainerStyle
, I think it's more intuitive. - Update the docs to include this feature
- Update the changeset based on my suggestion
Done. Thanks for the review. |
Closes #4387
This PR is a continuation of #4432 since that PR seems to have been abandoned. As such, the description is copied from that original PR and extended if necessary.
📝 Description
When users set a fixed-width on their custom toast, this causes their toast to not be centered. This is because we set a fixed
maxWidth
property on the wrapper component around the toast, which results in the invisible wrapper being centered correctly, but the visible custom component overflowing the parent (the wrapper), making it seem off-centered.A more detailed explanation of why this arises can be found here
⛳️ Current behavior (updates)
The div (with
class="chakra-toast__inner"
) wrapping the dispatchedToast
component currently has a hardcoded style, causing toasts to appear off-center if its child element has a width that is higher than the hardcodedmaxWidth
of560px
.🚀 New behavior
Instead of only exposing the maxWidth prop so that that behaviour can be fixed, instead opt to expose (a new)
wrapperStyles
prop so users can freely update the hardcoded style and more.For example, the off-center bug can be fixed with
💣 Is this a breaking change (Yes/No):
No
📝 Additional Information