DS0
Components

Toast

A temporary, non-blocking notification that appears at the edge of the screen and auto-dismisses.

Overview

Toast provides temporary notifications that auto-dismiss. It uses a global store pattern with both a React hook (useToast) and an imperative function (toast()).

Changes saved

Your settings have been updated.

Upload failed

File size exceeds 10MB limit.

Usage


// 1. Add Toaster to your root layout
function RootLayout({ children }) {
  return (
    <>
      {children}
      <Toaster position="bottom-right" />
    </>
  );
}

// 2. Show toasts from anywhere
toast({ title: 'Saved', description: 'Your changes were saved.' });
toast({ title: 'Error', variant: 'destructive', description: 'Something went wrong.' });

Variants

VariantUse For
defaultGeneral notifications
successConfirmations
warningNon-critical warnings
destructiveError states

Toaster Positions

top-left, top-center, top-right, bottom-left, bottom-center, bottom-right

API Reference

toast(options) — imperative function

OptionTypeDefaultDescription
titlestringTitle text
descriptionstringDescription text
variantstring'default'Visual variant
durationnumber5000Auto-dismiss (ms)
actionReactNodeAction element
### `<Toaster>` — viewport component
PropTypeDefaultDescription
positionstring'bottom-right'Screen position
maxVisiblenumber5Max visible toasts
  • Alert — Persistent, inline notifications
  • Dialog — Critical confirmations

On this page