Heads up!
You can add components to your app using the CLI.
Error
Your session has expired. Please log in again.
Installation
npx logic2b@next add alertUsage
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
<Alert variant="destructive">
<AlertTitle>Error</AlertTitle>
<AlertDescription>Something went wrong.</AlertDescription>
</Alert>
Usage notes
An optional leading svg icon is placed in its own column automatically. AlertTitle and AlertDescription accept the standard div props.
Examples
With icon
Drop a Lucide icon as the first child to render it alongside the title.
Heads up!
You can add components to your app using the CLI.
Destructive
Use variant="destructive" to signal an error state.
Unable to process your payment.
Please verify your billing information and try again.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Alert
variant="default"
className="grid-cols-1"
>Your changes have been saved.</Alert>Your changes have been saved.
API reference
Generated from the public TypeScript exports in src/ui/alert.tsx.
Alert
ComponentProps: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | null | "default" | "destructive" | No | — | — |
AlertTitle
ComponentProps: React.ComponentProps<"div">AlertDescription
ComponentProps: React.ComponentProps<"div">Accessibility contract
Machine-readable behavior and consumer responsibilities for alert.
- Support
- Native semantics
- Pattern
- alert
- HTML role=alert
Built-in semantics
- Uses role=alert so newly mounted urgent messages are announced.
Consumer responsibilities
- Reserve it for important dynamic messages; avoid mounting routine static content as an alert.