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

Snackbar

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Snackbar displays temporary notification messages that appear on screen to inform users about actions, errors, or other system feedback. Snackbars automatically dismiss after a duration or can be manually closed. Snackbar provides a flexible notification system built on Sonner, supporting multiple types, positions, and configurations. Snackbars appear temporarily to communicate important information without interrupting the user's workflow. They support titles, descriptions, action links, and custom durations with full keyboard and screen reader accessibility.
Props
Toaster
SnackbarProps (for show method)
NameDefaultDescription
titlerequiredThe main message text displayed in the snackbar.
descriptionOptional secondary text displayed below the title.
linkTextText for an optional action link button. Requires linkUrl.
linkUrlURL for the optional action link. Requires linkText.
onClickCustom click handler for the action link. If not provided, defaults to opening linkUrl.
onDismissCalled when the snackbar is dismissed manually (close button, swipe, or dismiss(id)). Not called for action-button clicks or auto-close.
onAutoCloseCalled when the snackbar auto-closes after duration. Sonner pauses this clock while hovered or while the document is hidden.
externalfalseWhether the link should open in a new tab/window.
duration5000Duration in milliseconds before the snackbar automatically dismisses.
typeToastSeverity.DefaultType of snackbar. Options: Default, Info, Success, Error, Warning.
idOptional unique identifier for the snackbar (useful for programmatic dismissal).
Storybook
Setup
Include Toaster in your application root to enable snackbar functionality. This docs app already mounts one manager in the shell, so live previews on this page omit <Toaster /> to avoid duplicate Sonner toasters (which would repeat every toast).
Examples
Use toast and a button. The shell Toaster displays the toast.
Default
With description
With link
With long link text
Info
Success
Error
Warning
Long title and description
Positioning
Positioning
Configure where snackbars appear with the position prop on your single Toaster at the app root. Use one manager only; mounting several Toaster / Sonner Toaster instances (for example in live previews) causes duplicate notifications. On this docs site, the shell uses ToastPosition.BottomCenter, so interactive examples above show toasts there.
Bottom Center (Default)
Top Positions
TopLeft, TopCenter, or TopRight:
Bottom Positions
BottomLeft, BottomCenter, or BottomRight:
Without Close Button
Hide close buttons for snackbars that must be read.
Live previews on this page use the app shell’s manager (close button enabled by default).
Multiple Snackbars
Multiple snackbars stack automatically when shown in sequence.
Snackbar Types
Snackbar Types
Use different types to convey semantic meaning.
Info
Success
Error
Warning
Default
Custom Duration
Control how long snackbars remain visible.
Programmatic Dismissal
Dismiss snackbars programmatically using their IDs.
With Description
With Description
Add descriptive text below the title.
With Action Link
Include an action link button for additional options.
External Link
Open links in a new tab or window.
Custom Link Handler
Provide a custom click handler for the action link.
Previous
Snackbar / Usage
Next
Snackbar / Accessibility
On this page
Props
Toaster
SnackbarProps (for show method)
Storybook
Setup
Examples
Default
With description
With link
With long link text
Info
Success
Error
Warning
Long title and description
Positioning
Positioning
Bottom Center (Default)
Top Positions
Bottom Positions
Without Close Button
Multiple Snackbars
Snackbar Types
Snackbar Types
Info
Success
Error
Warning
Default
Custom Duration
Programmatic Dismissal
With Description
With Description
With Action Link
External Link
Custom Link Handler