Toast
A brief, temporary notification that appears and disappears automatically.
- Status
- ReadyBuild day 6 of 21
- Code
- In React
- Role
- Feedback
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Transfer successful
Rp500.000 to Andi Pratama
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Toast } from "@/ui";
export default function ToastDemo() {
const [open, setOpen] = useState<boolean>(true);
if (!open) return null;
return (
<Toast
tone="success"
title="Transfer successful"
description="Rp500.000 to Andi Pratama"
actionLabel="Undo"
onAction={() => setOpen(false)}
onClose={() => setOpen(false)}
/>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Transfer successful
Rp500.000 to Andi Pratama
Pastes as editable layers. Shadows are not exported.
Props
- title
- string · default none
- Required. The short message.
- description
- string · default none
- A second line with detail.
- tone
- "info" | "success" | "warning" | "danger" · default "info"
- Color and icon. The icon is locked per tone.
- type
- "solid" | "subtle" · default "subtle"
- Filled or soft background.
- size
- "sm" | "md" · default "md"
- Vertical padding.
- actionLabel, onAction
- string, () => void · default none
- A text action such as Undo. Both are needed to show it.
- onClose
- () => void · default none
- Shows the close button.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- type
- solid or subtle.
- 📐 Size
- size
- sm or md.
- 🎨 Tone
- tone
- info, success, warning, or danger.
- Show Icon Left
- None
- No prop. The icon is always shown, locked per tone.
- Title, Description
- title, description
- Pass description to show the second line.
- Show Button, Button Value
- actionLabel, onAction
- Both together.
- Show Close
- onClose
- Pass onClose to show the button.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- The action and close buttons are native buttons: Tab focuses them and Enter or Space activates them.
Screen readers
- Danger uses role=alert and is read at once. The other tones use role=status and are read politely.
- The close button is named Close notification. Icons are aria-hidden.
What you still need to do
- Show, stack, and dismiss toasts in your app. This component is only the toast.
- Auto-dismiss after 5 seconds, or 8 with an action. Danger never auto-dismisses: the user must acknowledge an error.
- Give the user enough time to reach the action before it goes.
When to use
Confirms the result of an action, like saving or sending.
Do and don't
Do
- Keep it on screen until the reader dismisses it, or let them turn auto-dismiss off (WCAG 2.2.3 No Timing).
- Keep the message short and specific to what just happened.
Don't
- Use for critical errors that require action: use an alert or modal instead.
- Stack too many toasts at once.
Related
4 of 28 other molecules, same role and ready ones first.
- AlertA persistent, inline message that communicates important information.Ready
- Progress BarShows how much of a task is complete.Ready
- SkeletonA gray placeholder in the shape of content that is still loading.Ready
- AccordionStacked sections that expand to reveal their content.Ready
Status reflects the component tracker snapshot of 29 October 2026.