Toast Stack as a composable element #875
hunterloftis
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I'm definitely open to this!
Can you elaborate on this statement? As it stands, Shoelace requires the light and/or dark theme since most components use those design tokens. There are a small number of utility styles that get included, two of which are related to the toast stack. It's not clear to my what the benefit of moving this to a component is, especially if it's only used once per page. Is the goal to allow multiple toast stacks to be present on the page? Or are we mostly looking to remove these utility styles by componentizing the toast stack? Thanks for clarifying! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Many Shoelace components compose others, or are composed of others, in ways that "just work." (eg: Menu, Dropdown, Select, Button, Icon...)
Alert's "toast" functionality deviates from this with a predefined singleton that depends on CSS at the page level. That breaks functionality like JS-importable themes.
Would you consider a composition story like this?
(To be activated the same way as today:
alert.toast()
)That would allow a broader variety of apps & layouts to leverage the toast stack functionality, and I think it would map well to Shoelace's other idioms. It would also let developers avoid this action-at-a-distance behavior:
A lower-impact variant of this idea is:
Allow an optional
toastStack
to be passed into the toast() function. That way, default/today's usage continue to leverage the singleton, but a developer could simply:Beta Was this translation helpful? Give feedback.
All reactions