Alert
A persistent, inline message that communicates important information.
- Status
- ReadyBuild day 7 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.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Alert, type AlertTone } from "@/ui";
const tone: AlertTone = "warning";
export default function AlertDemo() {
const [open, setOpen] = useState<boolean>(true);
if (!open) return null;
return (
<Alert
tone={tone}
title="Your session ends in 5 minutes"
description="Save your changes to keep them."
onClose={() => setOpen(false)}
/>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- title
- string · default none
- Required.
- description
- ReactNode · default none
- Detail under the title.
- tone
- "info" | "success" | "warning" | "danger" · default "info"
- Color and icon, locked together.
- action
- ReactNode · default none
- A link or button for the next step.
- onClose
- () => void · default none
- Shows the dismiss 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.
- Tone
- tone
- info, success, warning, or danger.
- Title, Description
- title, description
- Same text.
- Action
- action
- Pass a link or button.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- The dismiss button and any action are reachable with Tab.
Screen readers
- Danger uses role=alert and is read at once. Other tones use role=status.
What you still need to do
- An alert stays until the problem is gone. For a short confirmation that disappears, use Toast.
When to use
Warnings, errors, and important context tied to a section of the page.
Do and don't
Do
- Match color and icon to severity (info, success, warning, danger).
- Keep messages actionable and specific.
Don't
- Use for transient confirmations: use a toast instead.
- Overuse alerts for low-priority information.
Related
4 of 28 other molecules, same role and ready ones first.
- Progress BarShows how much of a task is complete.Ready
- SkeletonA gray placeholder in the shape of content that is still loading.Ready
- ToastA brief, temporary notification that appears and disappears automatically.Ready
- AccordionStacked sections that expand to reveal their content.Ready
Status reflects the component tracker snapshot of 29 October 2026.