eds-toast
Explore the Interactive Component
Use the playground below to experiment with the component. Click the button to view the full Storybook deployment for additional examples and configurations.
See It in Use with Code
Check out this practical implementation of component.
Plain HTML
In React and Vue
Banner Variant
variant="banner" renders a richer inline banner for persistent, in-page status: a heading over the message, an optional dismissible close button and an actions slot (actions-placement="end" or "below").
Showing Toasts from Code
<eds-toast-manager> renders a stack of toasts on demand. Place it once in the page; on connect it registers itself with the toast singleton (src/utils/toastManager.ts), whose toast.show(message, intent) accepts 'default' | 'success' | 'error' | 'warning'. If no manager is rendered, toast.show() only logs an error.
toast is used inside the component library and is not exported from the package entry point. From application code, dispatch the same show-toast event the helper sends:
Intents
intent | Use for |
|---|---|
default / neutral | General confirmation |
success | Action completed |
error | Something failed (keep it recoverable; use an alert when the user must act) |
warning | Caution |
info | Information |
brand / brandInverse | Branded message (dark / light) |
Set duration (ms) to dismiss automatically; without it the toast stays until closed.
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
actionsPlacement | actions-placement | Where slotted actions sit. Banner variant only. - “end”: at the end of the row, beside the dismiss (default). - “below”: under the message, so a link reads as part of the text and the dismiss stays alone at the end. | "below" | "end" | 'end' |
dismissible | dismissible | Show a dismiss (×) button regardless of duration. The toast variant already shows one whenever duration is set; set this for a persistent banner the user can still close. | boolean | false |
duration | duration | Determines the duration before the toast auto-dismisses (in milliseconds). If set, the toast will auto-dismiss and show a close button. If not set (or set to 0), it will persist without a close button. | number | undefined |
heading | heading | Bold heading shown above the message (both variants). | string | undefined |
icon | icon | Leading icon name (from the EBRAINS icon set). Falls back to a default per intent when omitted (the toast variant shows none for the neutral default / neutral intents). | string | undefined |
intent | intent | The visual intent or style of the toast, indicating the toast type. | "brand" | "brandInverse" | "default" | "error" | "info" | "neutral" | "success" | "warning" | 'default' |
message (required) | message | The main message or text to be displayed in the toast. | string | undefined |
variant | variant | Visual variant: - “toast”: the compact floating notification (intent icon + message + close) on a raised surface. Default; used by the global toast manager. - “banner”: a richer inline banner — leading icon in a square, a bold heading over a mono message on a tinted status surface, an optional actions slot and an optional dismiss button. Use for persistent, in-page status (form expiry, saved draft, etc.). | "banner" | "toast" | 'toast' |
Events
| Event | Description | Type |
|---|---|---|
toast | CustomEvent<{ visible: boolean; label: "dismissed" | "shown"; }> |
Dependencies
Used by
- eds-toast-manager
Depends on
Graph
graph TD; eds-toast --> eds-icon-wrapper eds-toast-manager --> eds-toast style eds-toast fill:#f9f,stroke:#333,stroke-width:4px
Built with StencilJS