Share status and feedback without interrupting the page. Start with a title and description, then add an icon or action when useful.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert> <AlertTitle>Registry sync finished</AlertTitle> <AlertDescription> New items are listed locally. Refresh the docs if a page still looks stale. </AlertDescription> </Alert> )}Installation
npx @arctis-sh/@arctis-sh/ui@latest add alertUsage
import { Alert, AlertAction, AlertDescription, AlertTitle,} from "@/components/ui/alert"<Alert> <AlertTitle>Registry sync finished</AlertTitle> <AlertDescription> New items are available locally. Refresh the docs if a page still looks out of date. </AlertDescription></Alert>Composition
Alert ├── Icon ├── AlertTitle ├── AlertDescription └── AlertAction
The title and description carry the message. Add an SVG as a direct child for a leading icon, and use AlertAction for an optional control in the top-right.
Basic
A simple title and description, without an icon.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert> <AlertTitle>Registry sync finished</AlertTitle> <AlertDescription> New items are listed locally. Refresh the docs if a page still looks stale. </AlertDescription> </Alert> )}With icon
Pass an SVG as a direct child of Alert to show a leading icon.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert> <CheckIcon /> <AlertTitle>Component installed</AlertTitle> <AlertDescription> Source landed in your repo. Open the file and tweak it like any other local module. </AlertDescription> </Alert> )}Success
Use variant="success" to confirm a completed action.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert variant="success"> <CheckIcon /> <AlertTitle>Theme tokens applied</AlertTitle> <AlertDescription> Light and dark variables are wired. Preview the docs site to confirm contrast. </AlertDescription> </Alert> )}Warning
Use variant="warning" for cautionary or time-sensitive information.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert variant="warning"> <WarningIcon /> <AlertTitle>CLI cache is outdated</AlertTitle> <AlertDescription> Run a fresh install before adding components so you do not pull a stale registry snapshot. </AlertDescription> </Alert> )}Destructive
Use variant="destructive" for failures and errors that need attention.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"export function Example() { return ( <Alert variant="destructive"> <AlertCircleIcon /> <AlertTitle>Could not resolve registry</AlertTitle> <AlertDescription> The namespace URL did not return an index. Check the registries map in your config and try again. </AlertDescription> </Alert> )}Action
Wrap a button or other control in AlertAction. Add right padding to Alert so the message has room beside it.
import { Alert, AlertAction, AlertDescription, AlertTitle,} from "@/components/ui/alert"import { Button } from "@/components/ui/button"export function Example() { return ( <Alert className="pr-28"> <InfoIcon /> <AlertTitle>New accordion patterns</AlertTitle> <AlertDescription> Nested and card-grid examples shipped. Pull the latest docs when you have a minute. </AlertDescription> <AlertAction> <Button type="button" size="sm"> View </Button> </AlertAction> </Alert> )}API Reference
Alert
| Prop | Type | Default |
|---|---|---|
| variant | "default" | "success" | "warning" | "destructive" | "default" |
| className | string | — |
| role | "alert" | "alert" |
<Alert> <AlertTitle>Sync complete</AlertTitle> <AlertDescription>Your local registry is up to date.</AlertDescription></Alert>AlertTitle
| Prop | Type | Default |
|---|---|---|
| className | string | — |
<AlertTitle>Sync complete</AlertTitle>AlertDescription
| Prop | Type | Default |
|---|---|---|
| className | string | — |
<AlertDescription>Your local registry is up to date.</AlertDescription>AlertAction
| Prop | Type | Default |
|---|---|---|
| className | string | — |
<AlertAction> <Button size="sm" variant="outline">Undo</Button></AlertAction>