Alert
Displays a callout for important, contextual messages.
Last updated August 8, 2026
CreditsModifiedPublished
Copied from shadcn/ui.
- Replaced physical pr-18/right-2 with logical pe-18/end-2 for RTL
- Replaced text-left with text-start
Overview
Changes saved
Your changes have been saved.
import { CheckCircle2Icon } from "lucide-react"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
export function AlertDemoExample() {
return (
<Alert className="w-full max-w-sm">
<CheckCircle2Icon />
<AlertTitle>Changes saved</AlertTitle>
<AlertDescription>Your changes have been saved.</AlertDescription>
</Alert>
)
}Installation
$ npx shadcn@latest add https://ui.persian-labs.ir/r/alert.jsonUsage
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
export function Example() {
return (
<Alert>
<Icon />
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>
You can add components to your app.
</AlertDescription>
</Alert>
)
}Destructive
Unable to process payment
Please verify your billing information and try again.
import { AlertCircleIcon } from "lucide-react"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
export function AlertDestructiveExample() {
return (
<Alert variant="destructive" className="w-full max-w-sm">
<AlertCircleIcon />
<AlertTitle>Unable to process payment</AlertTitle>
<AlertDescription>
Please verify your billing information and try again.
</AlertDescription>
</Alert>
)
}Action
Use AlertAction to place a button in the corner of the alert.
New version available
A new version of the registry is ready to install.
import { MegaphoneIcon } from "lucide-react"
import {
Alert,
AlertAction,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
import { Button } from "@/components/ui/button"
export function AlertActionExample() {
return (
<Alert className="w-full max-w-sm">
<MegaphoneIcon />
<AlertTitle>New version available</AlertTitle>
<AlertDescription>
A new version of the registry is ready to install.
</AlertDescription>
<AlertAction>
<Button size="sm" variant="outline">
Update
</Button>
</AlertAction>
</Alert>
)
}RTL
تغییرات ذخیره شد
تغییرات شما با موفقیت ذخیره شدند.
import { CheckCircle2Icon } from "lucide-react"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
export function AlertRtlExample() {
return (
<Alert className="w-full max-w-sm">
<CheckCircle2Icon />
<AlertTitle>تغییرات ذخیره شد</AlertTitle>
<AlertDescription>تغییرات شما با موفقیت ذخیره شدند.</AlertDescription>
</Alert>
)
}