-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
carbon-components-react/ToastNotification: Add onClose
prop
#7859
Comments
@kubijo does the existing |
I wouldn't ask if it did… It's called after internal state setter, which removes the DOM content. What I do is imperative animation of DOM nodes through gsap & removal in a completion callback, so I need a complete control over what's happening. |
I'm not sure if we want to provide a controlled mode for the notification components (i.e. an |
I don't believe that you'd be able to achieve what we're going for just in the From what I've seen so far this kind of thing seems to be intentionally left out from the library & I sort of believe that it's out of its scope… On the other hand, my proposition takes minimal amount of work on your side and pretty much unblocks users from doing what they need. |
I'm not sure if our animations for notification dismissal have been finalized, can you share what you may be referencing? but regardless I'm not sure if we'll support custom animations for notification dismissal even after we implement our own animations out of the box |
https://www.carbondesignsystem.com/components/notification/usage This is the part that our designer shared with me… we did change it a bit (as you can see on the screencast) so that the slide-out is to the right.
I can see that being something you wouldn't want to do, but I'm not asking you to… all I need is to be able to do it myself while being hooked onto the close button without hacks involving |
I think it would be great for us to provide the animation out of the box rather than supporting a controlled mode for the notification component. If for whatever reason we decide not to provide the animations out of the box then I will implement a controlled mode (along the lines of AccordionItem, Modal, etc). I reached out to our designers for more details on the notification dismissal animation behavior, and we may end up baking it into the component. does that sound reasonable? that being said I'll do some exploration on controlled notifications separately and may end up implementing it to provide flexibility |
Thank you 👍 |
Considered all I've said above I'm fine with the way things are now (once the |
What package(s) are you using?
carbon-components
Detailed description
Will you please add an
onClose: () => void
prop to theToastNotification
react component?It should replace the inner setState so that it's possible to implement the animation behaviour defined in your design guidelines without ugly hacks that hijack the close button handler.
I've solved this for now by removing the close button & hooking our handler to
onClick
, but our UX designer is not amused and would like to keep the close button instead.The text was updated successfully, but these errors were encountered: