Alert
Server-safe inline banner: tinted surface, colored icon, title, description and an optional action. Info, success, warning and destructive tones follow the accent and status tokens.
New version available
Bot connected
Token expires in 2 days
Payment failed
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";import { Button } from "@/components/ui/button";export function TokenWarning() { return ( <Alert variant="warning" action={ <Button size="sm" variant="outline"> Renew </Button> } > <AlertTitle>Token expires in 2 days</AlertTitle> <AlertDescription> Renew it to keep the dashboard in sync. </AlertDescription> </Alert> );}<Alert>
Inline banner: tinted surface, colored icon, title and description. No live-region role by default (a static banner should not be announced on load); add role="alert" when it appears in response to something the user did.
actionReactNodeRight-aligned slot, e.g. a small Button.
iconReactNodeReplaces the variant's icon; pass
nullfor none.variantdefault"default""default" | "info" | "success" | "warning" | "destructive"Tone: sets the tint and the default icon.
| Prop | Type | Default |
|---|---|---|
actionRight-aligned slot, e.g. a small Button. | ReactNode | — |
iconReplaces the variant's icon; pass | ReactNode | — |
variantTone: sets the tint and the default icon. | "default" | "info" | "success" | "warning" | "destructive" | "default" |
Also accepts every <div> prop.
<AlertTitle>
Also accepts every <p> prop (none of its own).
<AlertDescription>
Also accepts every <div> prop (none of its own).
* required. Every component also takes className.