Alert
Pre-alphaThe registry and the CLI are not published yet.Roadmap

Alert

Inline feedback: info, success, warning or error.

Account
New sign-in methodYou can now use passkeys.
Email verified
Storage almost fullFree up space to keep syncing.

Manage storage

Payment failedYour card was declined.

Maintenance on Sunday, 02:00–03:00.

Installation

npx axiom add alert
pnpm dlx axiom add alert
yarn dlx axiom add alert
bun x axiom add alert

Also copies: icon-button.

Requires the info, success, warning, error and close icons in your icon registry. Colors come from alert.<variant>.default.{background,icon,border} in the component tokens.

Usage

import { Alert } from "@/components/ui/alert";

<Alert variant="warning" title="Storage almost full">
	Free up space to keep syncing.
</Alert>;

Props

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'error' | 'neutral''info'Picks the subtle background and icon color from the feedback colors (feedback.warningSubtle + feedback.warning…).
titleReactNodeShort, bold summary. An alert can have only a title, only a description, or both.
childrenReactNodeDescription under the title, in content.muted.
iconIconName | nullper variantLeading icon. Each variant has a default (info, success, warning, error; info for neutral); null removes it.
action{ label: string; onPress: () => void }A text action under the description, such as “Manage storage” or “Retry”.
onDismiss() => voidShows a close button in the top-right corner. Hiding the alert is up to you.
accessibilityLiveRegion'polite' | 'assertive' | 'none''assertive' for error, 'none' otherwiseAnnounces the alert when it appears. error alerts are announced and get accessibilityRole="alert"; others are read in order.
styleStyleProp<ViewStyle>Extra styles for the container.

Use cases

Form error summary

Above a form, after a failed submit. Say what went wrong and what to do; the fields show the details.

Sign in
Wrong email or password

3 attempts left before a 15-minute lock.

Password
••••••••
{
	error && (
		<Alert variant="error" title="Wrong email or password">
			{attemptsLeft} attempts left before a 15-minute lock.
		</Alert>
	);
}

Warning with an action

The action fixes the problem right there, without a trip to another screen first.

Settings

Your plan ends in 3 days

You’ll lose access to shared projects.

Renew now

Profile
Billing
<Alert
	variant="warning"
	title="Your plan ends in 3 days"
	action={{ label: "Renew now", onPress: openBilling }}
	onDismiss={() => setDismissed(true)}
>
	You'll lose access to shared projects.
</Alert>

Contextual information

A neutral or info alert next to the content it explains, where a tooltip would be missed.

Transfer
Amount

2,500.00

Transfers over €2,000 arrive the next business day.

Continue

{
	amount > 2000 && (
		<Alert>Transfers over €2,000 arrive the next business day.</Alert>
	);
}

When to use it

Alert stays in the layout, next to the content it describes. For a message that appears and goes away, use Toast or Snackbar.