ComponentsOverlays & feedback
A persistent inline status message in a page, card or form: an unsaved revision, a missing tax ID, a filing deadline, a subscription banner. Six tones, three variants, optional actions and dismiss. Server-compatible.
components/alert.tsxtheme · material · accent · density · font
Installation
$ pnpm add @vamos-ui/react
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { Alert, Button } from "@vamos-ui/react";
<Alert tone="warning" title="Payroll filing due in 3 days" actions={<Button size="xs">Review</Button>}>
Submit the November declaration before Dec 26.
</Alert>Examples
Variants and sizes
soft (default), outline, sm, and icon={false}.
Actions and dismiss (CMS)
actions sit under the text; onDismiss adds a localized close button.
Form submit error
An alert inserted after submit uses live="assertive" (role="alert") so it is announced.
API
Alert
| Prop | Type | Default |
|---|---|---|
toneIcon, title and tint colour. Body text stays --fg for contrast. | "neutral" | "info" | "success" | "warning" | "danger" | "accent" | "neutral" |
variantTinted card, hairline only, or a full-width strip. | "soft" | "outline" | "banner" | "soft" |
sizePadding, text and icon size. | "sm" | "md" | "md" |
titleBold first line in the tone colour. | ReactNode | — |
childrenThe message. | ReactNode | — |
iconCustom icon or none. Each tone has a default. | ReactNode | false | — |
actionsButtons or links — below the text, inline for banners. | ReactNode | — |
onDismissAdds a close button (client components only). | () => void | — |
dismissLabelAccessible name of the close button (dictionary alert.dismiss). | string | "Dismiss" |
liveFor alerts inserted at runtime: polite → role="status", assertive → role="alert". Leave unset for static messages. | "polite" | "assertive" | — |
AlertTitle / AlertDescription / AlertActions
| Prop | Type | Default |
|---|---|---|
classNameCompose your own layout inside an Alert with these parts. | string | — |