Components
Alert
Contextual feedback message for user actions or system events, with optional dismiss and action.
Heads up
Something you should know.
Installation
npx asteria-ui add alertUsage
import { Alert } from "@/components/ui/alert";
<Alert variant="success" title="Saved" description="Your changes have been saved." />Examples
Variants
Info
A short description of what happened.
Success
A short description of what happened.
Warning
A short description of what happened.
Error
A short description of what happened.
With action and dismiss
Upload failed
The file exceeds the 10MB size limit.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "info" | "success" | "warning" | "error" | "info" | Color treatment and icon. Also determines the role: warning/error use role=alert, info/success use role=status. |
| title | ReactNode | — | Bold heading line. |
| description | ReactNode | — | Body text, always fg-secondary regardless of variant. |
| actionLabel | ReactNode | — | Renders a text-style action button when present. |
| onAction | () => void | — | Called when the action button is clicked. |
| dismissible | boolean | false | Shows a dismiss button with aria-label="Dismiss". |
| onDismiss | () => void | — | Called when the dismiss button is clicked. |
Accessibility
Accessibility
Role is variant-dependent.
warning/erroruserole="alert"(assertive, interrupting) —info/successuserole="status"(polite). This is computed automatically from thevariantprop, not something you set yourself.Icon. Decorative,
aria-hidden.Dismiss button.
aria-label="Dismiss".