Loading...
Loading...
> Displays a callout for user attention with title and description.
1import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"
1<Alert>2 <Info className="h-5 w-5" />3 <AlertTitle>Heads up!</AlertTitle>4 <AlertDescription>5 You can add components to your app using the cli.6 </AlertDescription>7</Alert>
1<Alert>2 <Info className="h-5 w-5" />3 <AlertTitle>Information</AlertTitle>4 <AlertDescription>5 This is a default alert message with important information.6 </AlertDescription>7</Alert>
1<Alert variant="destructive">2 <XCircle className="h-5 w-5" />3 <AlertTitle>Error</AlertTitle>4 <AlertDescription>5 Your session has expired. Please log in again.6 </AlertDescription>7</Alert>
1<Alert variant="success">2 <CheckCircle2 className="h-5 w-5" />3 <AlertTitle>Success</AlertTitle>4 <AlertDescription>5 Your changes have been saved successfully.6 </AlertDescription>7</Alert>
1<Alert>2 <AlertTitle>Note</AlertTitle>3 <AlertDescription>4 This alert does not include an icon.5 </AlertDescription>6</Alert>
1<Alert>2 <AlertCircle className="h-5 w-5" />3 <AlertTitle>Important: Maintenance scheduled for tonight</AlertTitle>4</Alert>
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "destructive" | "success" | "default" | The visual style of the alert. |
| className | string | - | Additional CSS classes to apply to the alert. |
✓ Use Alert when:
✗ Don't use when:
Variant Selection: