Skip to content

Toast

Toast displays brief, temporary notifications that provide feedback without interrupting the user's workflow. It supports automatic closing, manual closing, stacking, progress bars, ESC key closing, responsive viewport adaptation, and show/hide animations.

BrToast uses BrConfigProvider for global theme configuration (colors, radius, shadows, z-index, etc.), and supports both component-based and function-based invocation.

Basic Usage

Click the button to show a default Toast (auto-close + manual close).

Example

Variants

Use the variant prop to control the visual style of the Toast:

  • Default: Default style
  • Primary: Primary style
  • Success: Success style
  • Error: Error style
  • Warning: Warning style
  • Info: Info style
Example

Positioning & Stacking

Supports 8 positions (top/top-left/top-center/top-right/bottom/bottom-left/bottom-center/bottom-right), along with stacking and progress bars.

Select Position
Example

Theming

Use BrConfigProvider to globally configure default position, radius, shadow, variant colors, and z-index. You can also use utility classes for local overrides.

Global Customization (BrConfigProvider)

Theme Preview
Configure Toast tokens and default behavior globally via BrConfigProvider
Example

Local Override (TailwindCSS Classes)

Example

API

BrToast

PropTypeDefaultDescription
openbooleanundefinedControlled open state (use with @update:open/v-model:open).
defaultOpenbooleanfalseUncontrolled initial open state.
durationnumberundefinedAuto-close duration (ms) for this toast. Overrides Provider's duration.
variant'default' | 'primary' | 'success' | 'error' | 'warning' | 'info''default'Visual variant style.
positionBrToastPositionundefinedPosition for this toast. Overrides Provider/BrConfigProvider.
dismissiblebooleantrueWhether to show close button and allow manual closing.
showProgressbooleanfalseWhether to show auto-close progress bar (requires duration > 0).
titlestring | ComponentundefinedTitle content (or use #title slot).
descriptionstring | ComponentundefinedDescription content (or use #description slot).
iconComponentundefinedIcon content (or use #icon slot).
classstring''Additional TailwindCSS classes for local style overrides.

BrToastProvider

PropTypeDefaultDescription
positionBrToastPositionundefinedOverrides BrConfigProvider's default position.
durationnumberundefinedOverrides BrConfigProvider's default auto-close duration (ms).
closeDelaynumberundefinedDelay (ms) before removing from stack after closing, to preserve exit animation.
maxnumberundefinedMaximum number of stacked toasts. Older toasts are removed when exceeded.
closeOnEscapebooleanundefinedWhether to allow closing the latest toast with ESC key.
viewportClassstring''Additional classes for the Viewport, for local layout overrides.

useToast

FieldTypeDefaultDescription
toast(options: BrToastOptions) => { id, dismiss, update }-Triggers a toast and returns a handle (can update/dismiss).
dismiss(id?: string) => void-Dismisses a specific toast. If id is omitted, dismisses all.
update(id: string, patch: BrToastOptions) => void-Updates a specific toast's configuration (title/description/variant/duration etc.).
toastsRef<BrToastItem[]>-Current list of toasts (for custom rendering scenarios).