Alert

An inline message that draws attention without interrupting the task, with optional actions and a dismiss button.
Stable
Web
iOS
Android
@advui/core
Source
Heads upYou can add components using the CLI.
JSX
<Alert title="Heads up" description="You can add components using the CLI." />
variant
size

Installation

pnpm
pnpm add @advui/core
npm
npm install @advui/core

Usage

import { Alert, Button } from '@advui/core'

<Alert
  variant="warning"
  title="Trial ending"
  description="Upgrade to keep your projects."
  actions={<Button size="sm">Upgrade</Button>}
  dismissible
/>

Examples

Variants

Heads upYou can add components using the CLI.
Scheduled maintenanceSunday 02:00–03:00 UTC.
Payment received

Sizes

SmallFor forms, tables and other dense layouts.
MediumThe default, for most pages.
LargeFor the one message a page is about.

Actions

Buttons under the text; on a narrow screen they wrap.

Dismissible

With `open` and `onDismiss` the app decides when it shows. Without `open`, it hides itself.

Custom icon, colors and radius

Style props and `color` take precedence over the variant and size; everything else keeps their values.
New: shared workspacesInvite your team and work on the same projects.
TipSort by the last column to see this week's growth.

Composition

Compose `Alert.Title`, `Alert.Description` and any content as children.
Before you upgrade
1. Back up the database.2. Read the migration guide.3. Update every package at once.
Takes about ten minutes.

API reference

Alert

PropTypeDefaultDescription
variant'default' | 'info' | 'success' | 'warning' | 'error' | 'destructive''default'Intent: colors, icon and role. `destructive` is a solid fill for an action that cannot be undone.
size'sm' | 'md' | 'lg''md'Padding, spacing, icon and text size.
titleReactNode—Shorthand for an `Alert.Title` before the children. Text is styled; an element is rendered as it is.
descriptionReactNode—Shorthand for an `Alert.Description` after the title.
iconReactNode | nullfrom `variant`Custom icon, or `null` to hide it.
actionsReactNode—Buttons or links under the text. They wrap onto new lines when space runs out.
dismissiblebooleanfalseShows a button that hides the alert.
onDismiss() => void—Called once each time the dismiss button is pressed.
openboolean—Controls whether the alert is shown. Omit it and a dismissed alert hides itself; pass it to decide in `onDismiss`, or to show the alert again.
dismissLabelstring'Dismiss'Accessible name of the dismiss button.
role'status' | 'alert' | 'note' | 'region'from `variant``alert` for `warning`, `error` and `destructive`, otherwise `status`. Pass `note` for guidance that is part of the page, not news, or `region` with an `aria-label` for a landmark.
colorColorTokensfrom `variant`Color of the title, description and icons. Pair it with a background: `primaryForeground` on `primary`.
backgroundColorColorTokensfrom `variant`Overrides the variant background.
borderColorColorTokensfrom `variant`Overrides the variant border color.
borderWidthnumber1`0` for a borderless alert.
borderRadiusRadiusTokens | number'lg'Corner radius.
paddingSpaceTokens | numberfrom `size`Inner padding.
gapSpaceTokens | numberfrom `size`Space between the icon, the text and the dismiss button.

Alert.Title

Takes its size and color from the alert.

Alert.Description

Takes its size and color from the alert.

Accessibility

  • warning, error and destructive use role="alert", which screen readers announce at once; other variants use role="status", announced politely. Pass role to change it.
  • Only render an alert when something just happened. For guidance that is part of the page, pass role="note" so it is not announced.
  • The dismiss button is a real button with an accessible name (dismissLabel), reachable with Tab and pressed with Enter or Space. It does not pass the press on to a pressable around the alert.
  • When the alert hides, focus is not moved for you. If it held focus, move focus to a sensible place in onDismiss.
  • Color is paired with an icon and text, never used alone. With color or backgroundColor, pick a surface and foreground pair from the theme.

Responsive behavior

Fills the width of its container; pass alignSelf="flex-start" to fit the content instead. The text wraps, the icon and dismiss button stay on the first line, and actions wrap onto new lines.

Platform notes

Web
The frame carries the role, so a live region announces the text and the actions.
iOS
Without actions or a dismiss button the whole alert is one accessible element. With them, the text is one element and each button is its own.
Android
Same as iOS. With androidRipple (on in material()), the dismiss button shows the native ripple.
Since v0.1.0Last updated Nov 2, 2026Edit this page on GitHub