Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Toast
  3. API and Development

Toast

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
toast
Every call returns the toast id. toast.dismiss(id) removes one toast and toast.dismiss() removes every toast, including calls still waiting for a Toaster.
OptionTypeDefaultNotes
idstringgeneratedA second call with the same id updates the toast and restarts its timer
descriptionLocalizedMessagenoneSecondary text, clamped to three lines like the title
action{ label: LocalizedMessage; onClick?: () => void }noneA Button. Pressing it dismisses the toast without onDismiss
durationnumber (ms)5000Infinity keeps the toast until dismissed. The clock pauses on pointer, focus, and a hidden document
sourceNodefirst ToasterElement the message comes from. The toast shows in that element's document
onDismiss() => voidnoneThe person closed it (close button, Escape, swipe), or toast.dismiss removed it. Not called after the timer or the action
onAutoClose() => voidnoneThe timer dismissed it
severityToastSeverityDefaultOnly on toast itself; the helpers fix it
Toaster
PropTypeDefaultNotes
labelLocalizedMessagerequiredAccessible name of the notifications region. Name the Alt+T shortcut here to have it announced
closeButtonbooleantruefalse hides the close button; closeLabel is then not allowed
closeLabelLocalizedMessagerequired with a close buttonAccessible name of every close button
positionToastPositionBottomCenterInline edges are logical: TopStart is the right in RTL
visibleToastsnumber3More toasts collapse behind the newest
expandbooleanfalseKeeps the stack fanned out
Toaster takes no className and no style. Mount one per document that shows toasts.
Enums
  • ToastSeverity: Default, Info, Success, Warning, Error.
  • ToastPosition: TopStart, TopCenter, TopEnd, BottomStart, BottomCenter, BottomEnd.
Dependency
Toast is built on sonner, a runtime dependency pinned to one version. Only this component imports it. The reasons and the known gaps are in ADR 0005, section Toast.
Props

No extracted props

This component does not declare package-specific props in the generated API. It may still accept standard HTML and React attributes for its underlying element (for example className, id, and ARIA attributes). Props whose types come only from dependencies are omitted from this table.

Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Toast / Usage
Next
Toast / Accessibility
On this page
toast
Toaster
Enums
Dependency
Props
Storybook