- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Component alert-demo not found in registry.
Installation
pnpm dlx createui@latest add alert
Usage
import {
Alert,
AlertAction,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"<Alert>
<InfoIcon />
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>
You can add components and dependencies to your app using the cli.
</AlertDescription>
<AlertAction>
<Button variant="outline">Enable</Button>
</AlertAction>
</Alert>Examples
Basic
A basic alert with an icon, title and description.
Component alert-basic not found in registry.
Destructive
Use variant="destructive" to create a destructive alert.
Component alert-destructive not found in registry.
Action
Use AlertAction to add a button or other action element to the alert.
Component alert-action not found in registry.
Custom Colors
You can customize the alert colors by adding custom classes such as bg-amber-50 dark:bg-amber-950 to the Alert component.
Component alert-colors not found in registry.
API Reference
Alert
The Alert component displays a callout for user attention.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "destructive" | "default" |
AlertTitle
The AlertTitle component displays the title of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AlertDescription
The AlertDescription component displays the description or content of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AlertAction
The AlertAction component displays an action element (like a button) positioned absolutely in the top-right corner of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |