Toast

A succinct message that is displayed temporarily. Often used for feedback after an action.

When To Use

  • To provide feedback such as success, warning, error etc.
  • A notification with complex content.
  • A message that is displayed at top and center and will be dismissed automatically, as a non-interrupting light-weighted prompt.

Example Usage

Include the <Toast /> component once in your root layout. Then, use window.Toast.show() anywhere in your client-side JavaScript to render toasts.

Variants

Toasts include semantic variants (`success`, `error`, `info`, `warning`) that automatically render an appropriate icon and coloring.

Positions

Toasts can be rendered in different positions on the screen. The default is bottom-right.

Actions & Options

You can add an action button to the toast, adjust the auto-close duration, or remove the close button entirely.

API Reference

Property
Description
Type
Default

title

The main title text for the toast. string -

description

Secondary description text below the title. string -

variant

Semantic variant determining icon and color (success, error, info, warning). 'default' | 'success' | 'error' | 'info' | 'warning' 'default'

position

Screen position where the toast appears (e.g., top-right, bottom-center). 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center' 'bottom-right'

duration

Time in ms before auto-closing (set to 0 to disable). number 5000

closable

Whether to show the close button. boolean true

action

Configuration for an inline action button. ToastAction -