Command Palette

Search for a command to run...

Alert

Displays a callout for user attention.

Installation

npx shadcn@latest add alert

Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import { InfoIcon } from "lucide-react" export function AlertDemo() { return ( <Alert> <InfoIcon className="h-4 w-4" /> <AlertTitle>Heads up!</AlertTitle> <AlertDescription> You can add components to your app using the cli. </AlertDescription> </Alert> ) }

Examples

Destructive

Props

ComponentPropsDescription
AlertHTMLDivElement & VariantProps
variant?: "default" | "destructive"
The alert container that provides context and styling.
AlertTitleHTMLHeadingElementThe title displayed at the top of the alert.
AlertDescriptionHTMLParagraphElementThe description providing more detail about the alert.