Components
Alert
A callout for contextual feedback messages.
Alert is a styled div with role="alert". It supports a default and a destructive variant, and an optional action slot.
Installation
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/alert.jsonUsage
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
export default function Example() {
return (
<Alert>
<AlertTitle>Heads up</AlertTitle>
<AlertDescription>You can add components via the CLI.</AlertDescription>
</Alert>
);
}Examples
Variants
Heads up
You can add components to your app using the shadcn CLI.
Something went wrong
Your session has expired. Please log in again.
With an action
Use AlertAction to place a button in the corner of the alert:
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
export default function Example() {
return (
<Alert>
<AlertTitle>New version available</AlertTitle>
<AlertDescription>v2.0 is ready to install.</AlertDescription>
<AlertAction>
<Button size="sm">Update</Button>
</AlertAction>
</Alert>
);
}Components
| Component | Description |
|---|---|
Alert | Root container. Accepts variant ("default" or "destructive"). |
AlertTitle | Bold heading. |
AlertDescription | Muted body text. |
AlertAction | Positioned in the inline-end corner. |
Last updated on