Feedback
Alert
Inline status messages for information, success, warning, and destructive feedback.
Registry update available
Deployment complete
Usage limit approaching
Domain verification failed
Installation
Copy the source with the CLI to own and edit it, or import it from the npm package.
npx aback-ui@latest add alertWrites components/ui/alert.tsx. First time in this project? Run npx aback-ui@latest init first, as the installation guide shows.
Usage
Import the parts you need from the installed file. The Code tab above has a complete, working example.
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";API reference
Props and composition points for Alert. Native element props pass through.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "info" | "success" | "warning" | "destructive" | "muted" | "info" | Sets the semantic tone and surface. It never changes the accessible role. |
role | "alert" | "status" | None | Set explicitly. Use alert for an error that interrupts, and status for a confirmation. |
className | string | None | Layout adjustments only. Do not override the semantic colors. |
Dependencies: class-variance-authority, plus the shared @/lib/utils helper.
Accessibility
Semantics, keyboard behavior, and the decisions that keep the component operable.
- Every variant pairs color with an icon and a visible title, so meaning is never carried by hue alone.
- Error messages should use role alert and sit next to the control or action that caused them.
- A static informational alert needs no live role; adding one announces content on first paint.
- Description text inherits the variant color, which meets AA on its tinted surface.
Used in production
The Aback products whose interfaces shaped this component.