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.

eds-toast Open in Storybook

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

intentUse for
default / neutralGeneral confirmation
successAction completed
errorSomething failed (keep it recoverable; use an alert when the user must act)
warningCaution
infoInformation
brand / brandInverseBranded message (dark / light)

Set duration (ms) to dismiss automatically; without it the toast stays until closed.

Properties

PropertyAttributeDescriptionTypeDefault
actionsPlacementactions-placementWhere 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'
dismissibledismissibleShow 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.booleanfalse
durationdurationDetermines 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.numberundefined
headingheadingBold heading shown above the message (both variants).stringundefined
iconiconLeading 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).stringundefined
intentintentThe visual intent or style of the toast, indicating the toast type."brand" | "brandInverse" | "default" | "error" | "info" | "neutral" | "success" | "warning"'default'
message (required)messageThe main message or text to be displayed in the toast.stringundefined
variantvariantVisual 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

EventDescriptionType
toastCustomEvent<{ 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