✦ Asteria UI
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 alert

Usage

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.

With action and dismiss

API reference

PropTypeDefaultDescription
variant"info" | "success" | "warning" | "error""info"Color treatment and icon. Also determines the role: warning/error use role=alert, info/success use role=status.
titleReactNodeBold heading line.
descriptionReactNodeBody text, always fg-secondary regardless of variant.
actionLabelReactNodeRenders a text-style action button when present.
onAction() => voidCalled when the action button is clicked.
dismissiblebooleanfalseShows a dismiss button with aria-label="Dismiss".
onDismiss() => voidCalled when the dismiss button is clicked.

Accessibility

Accessibility

  • Role is variant-dependent. warning/error use role="alert" (assertive, interrupting) — info/success use role="status" (polite). This is computed automatically from the variant prop, not something you set yourself.

  • Icon. Decorative, aria-hidden.

  • Dismiss button. aria-label="Dismiss".