docs/components/alert
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Displays an alert for user attention.
PreviewCode
Heads up!
You can add icons to alerts to provide visual context and improve user experience.
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/alert
Alert
├── Icon
├── AlertTitle
├── AlertDescription
└── AlertAction
import {
Alert,
AlertTitle,
AlertDescription,
AlertAction,
} from "@/components/ui/alert";
<Alert>
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>You can add icons to alerts.</AlertDescription>
<AlertAction>
<Button size="xs" variant="ghost">Dismiss</Button>
<Button size="xs">Update</Button>
</AlertAction>
</Alert>
PreviewCode
Deployment successful
You can now start building your next great project.
PreviewCode
New update available
A new update is available. Check it out now.
PreviewCode
Storage almost full
Your storage is almost full. Consider upgrading your plan to avoid losing data.
PreviewCode
Payment successful
Your payment has been processed successfully. You will receive a receipt in your email.
PreviewCode
Session expired
Your session has expired. Please log in again.
PreviewCode
New Feature Available
Icons can be added to alerts to provide visual context and improve user experience.
PreviewCode
New update available
Check it out now.
IgnoreUpdate
PreviewCode
Fancy alert, huh?
This is a fancy alert with a custom color.
Root component.
| Prop | Type | Default |
|---|---|---|
variant | `"default" | "info" |
className | string | - |
asChild | boolean | false |
Title text.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Description text.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Container for action buttons. Automatically positioned to the right on larger screens.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
[
Previous page
Alert Dialog ](/docs/components/alert-dialog)[
Next page
Announcement ](/docs/components/announcement)
On This Page
InstallationAnatomyUsageVariantsDefaultInfoWarningSuccessDestructiveExamplesWith iconWith actionCustom colorAPI ReferenceAlertAlertTitleAlertDescriptionAlertAction