Skip to Content
Getting startedFoundationsComponentsPackagesTools

Toast

How a notice looks and that it is announced. Where and when it shows is yours.

Examples

Playground

Saved
Your changes are live.

Appearance

How strongly the tone is expressed: a tinted surface, or the tone as the surface.

subtle
Saved
Your changes are live.
solid
Saved
Your changes are live.

Tone

What the notice means. The tint, border and icon carry it; the icon differs in shape per tone.

neutral
Saved
Your changes are live.
info
Saved
Your changes are live.
success
Saved
Your changes are live.
warning
Saved
Your changes are live.
error

Content

Title only, a long description, a dismiss and an action. The icon and the close stay on the title line however many lines follow. The action is a `text` button so it reads as a link, not a second surface.

title only
Saved
long description, dismissable
Saved
Your changes are live for everyone in the workspace, and the previous version is kept in the history.
solid, dismissable
Saved
Your changes are live.
action, subtle
Message archived
action, solid
Message archived

Tone by appearance

Every combination. Solid takes each tone's AA-safe fill, so white ink passes on all five.

subtlesolidneutral
neutral subtle
Your changes are live.
neutral solid
Your changes are live.
info
info subtle
Your changes are live.
info solid
Your changes are live.
success
success subtle
Your changes are live.
success solid
Your changes are live.
warning
warning subtle
Your changes are live.
warning solid
Your changes are live.
error

Install

npx shadcn add @hipuku/toast

Usage

import { Toast } from '@/components/haus/components/Toast'

<Toast
  tone="success"
  title="Palette saved"
  description="3 colours added to Brand."
  onClose={() => dismiss(id)}
/>

API

Toast also takes its element's own attributes and forwards its ref. className lands on the root.

PropTypeDescription
tone"neutral" | "info" | "success" | "warning" | "error"
appearance"subtle" | "solid"
titlerequiredstringNamed rather than spread: it is the visible heading, not the tooltip the native title attribute would give.
descriptionstring
actionReact.ReactNode
onClose(() => void)

What you provide

Toast is the notice itself. Positioning, a queue, stacking and an auto-dismiss timer are yours: render toasts into your own container and remove them when you are done. onClose adds a dismiss button; action adds a control on the title's row.

To play its exit, set data-state="closed" on the toast, then remove it once the animation ends.

Tones and appearances

neutral, info, success, warning and error, each subtle (the default) or solid.

Accessibility

  • Announced when it appears: politely, or at once for an error, with the title and description read as one notice.
  • Not focusable itself. The action and the dismiss button keep their own place in the tab order.

A toast that appears already holding its text is not reliably announced. Keep your container on the page and render toasts into it. For a notice that must not be missed, keep a record the user can open again: an announcement is not a record.

On this page