Skip to content

Toast

Last updated 11 Nov 2026

NbToast is one toast: an icon, an optional title, a message, an optional action and a close button. It is the leaf.

Props ​

PropTypeDefaultDescription
messagestringnoneRequired. The body text.
variant'success' | 'error' | 'warning' | 'info''info'Accent, icon, hidden severity word, announcement politeness, and under a host the lifetime. Choosing the variant.
titlestringnoneOptional heading above the message.
durationnumber4000Milliseconds the countdown bar represents. Standalone, it is also the auto-dismiss timer. 0 draws no bar and never dismisses. Under a host the default comes from the variant instead (NB_TOAST_DURATIONS), and any toast with a cta defaults to 0.
cta{ label: string; action: () => void }noneOne action. Pressing it runs action(), emits action, then emits close.
role'alert' | 'status' | 'none''alert'ARIA role. A real prop, not a fallthrough attribute, so it cannot be lost by a later refactor. NbToaster passes none (see below).
ariaLive'assertive' | 'polite' | 'off'by variantPoliteness. Defaults to assertive for error and polite otherwise.
statusLabelstringthe variant, in wordsVisually hidden severity word, read before the title. Pass your own to translate it, or '' to suppress it.
closeLabelstringcatalogueAccessible name of the close button. Falls back to the catalogue's close.
managedbooleanfalsetrue when a host owns the clock. The toast then runs no timer of its own and takes its pause state from paused.
pausedbooleanfalseCountdown held. Only read when managed.
cyclenumber0Bump it to restart the countdown bar after the message changed, so a rewritten toast does not inherit the previous message's remainder.

Events ​

EventPayloadDescription
closenoneThe toast should be removed: the timer elapsed, the close button was pressed, or the action was taken.
actionnoneThe action was pressed. Emitted just before close, so a host can tell "the reader acted" from "it timed out".

The parent removes the component. NbToast never removes itself from the DOM.

Tokens ​

TokenUsed for
--nb-c-bg, --nb-c-borderSurface and outline.
--nb-c-success, --nb-c-danger, --nb-c-warning, --nb-c-infoIcon and the leading accent rule, per variant.
--nb-c-text, --nb-c-text-muted, --nb-c-text-subtleTitle, message, close button.
--nb-c-scrimThe shadow is mixed from it, so it deepens with the dark theme.
--nb-radius-md, --nb-radius-smCorners.
--nb-spacing-2/4/10/12/14/16/24Gaps, padding and the close button's box.
--nb-font-size-12, --nb-font-size-13Action, and the title and message.

Nothing here is a raw hex value or a token with a hardcoded fallback, and tests/Toaster.test.ts fails the build if one comes back.