compound-web
1456f133 - Add clickable Toast variant

Commit
30 days ago
Add clickable Toast variant Toasts can now be made clickable by passing `onClick`, in which case the whole toast renders as a `<button>`. This is mutually exclusive with the existing `onClose` close button — an interactive element cannot be nested inside a button — and the constraint is enforced via a discriminated union on the props. - Render as a `<button>` in clickable mode, with hover/active/focus-visible states and native button resets; otherwise render as a `<div>`. - Apply the Body SM Medium typography via `<Text>` on the content element so it applies in both the div and button containers (the close button is icon only and never needed it). - Add Clickable and ClickableWithIcon stories with screenshots, and default `onClick`/`onClose` off in the story args so Storybook's `argTypesRegex` doesn't force every toast into a button / closable state.
Author
Parents
Loading