Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Alert

  • Stable
  • WCAG 2.2 evidence
  • RTL

An inline status message about a section or a task: tone icon, title, optional description, actions and close button. A status region (role="status", or role="alert" when politeness="assertive") so the message is announced when it appears (WCAG 4.1.3); the tone has its own icon and a text alternative, never colour alone (1.4.1, 1.1.1). Presentational: renders in React Server Components. The close button is a small client island. Consumer duties: message wording ("say what happened and what to do next"), the urgency (politeness), removing the alert and moving focus in onDismiss. Use Toast for transient confirmations and Banner for page-wide notices.

import { Alert } from "@nexera-ui/react";
Loading example…
5
examples
9
props
5
live controls
1
platform
11
WCAG criteria
27
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
title
tone
politeness
layout
description
Generated code
import { Alert } from "@nexera-ui/react";

<Alert />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

Tones

Every Tone. Each has its own icon and a visually hidden text alternative ("Error:"), never colour alone.

Loading example…

Dismissible

The alert appears after an event (so it is announced) and the consumer removes it in onDismiss, moving focus back to the button that triggered it.

Loading example…

Long content

Long titles, descriptions and several actions wrap instead of truncating (translation adds 30 to 40 %).

Loading example…

Right to left

Right-to-left: the icon sits at the start (right), the close button at the end (left).

Loading example…

Props 9

Press "Try it" on a card to load that prop into the playground.

9 props shown

title*Nexera
ReactNode

What happened, for example "Leave policy updated". Keep it under 8 words. Wraps, never truncated.

Default –
toneNexera
"info" | "success" | "warning" | "danger" | "neutral"

Severity. Each tone has its own icon as well as its colour, and iconLabel names it for assistive technology, so the severity is never conveyed by colour alone (WCAG 1.4.1).

Default info
politenessNexera
"polite" | "assertive"

How assistive technology announces the alert when it appears (WCAG 4.1.3): polite renders role="status" (waits for the user), assertive renders role="alert" (interrupts; for urgent problems only). Render the alert when the event happens; an alert that is already on the page at load is not announced.

Default "assertive" for `tone="danger"`, `"polite"` otherwise
iconLabelNexera
string

Text alternative of the tone icon, read before the title followed by a colon ("Error: Payment failed"). Translate it for your locale; pass "" when the title already states the severity.

Default "Info", "Success", "Warning", "Error"; none for `neutral`
actionsNexera
ReactNode

Next steps, for example <Button variant="ghost" size="sm">View details</Button>. Shown when provided: under the text in the default layout, at the end of the row in the compact layout.

Default –
layoutNexera
"default" | "compact"

default stacks title, description and actions; compact is one row with the title and an action. One row with the title and an action.

Default default
descriptionNexera
ReactNode

What to do next, for example "Review the changes before your next request." Shown when provided, in the default layout only.

Default –
onDismissNexera
() => void

Shows the close button and is called without arguments when it is activated; accepts a Server Action. The alert does not hide itself: remove it in this callback, and move focus somewhere sensible (for example the heading of the section), because the focused button disappears with it.

Default –
dismissLabelNexera
string

Accessible name of the close button. Translate it for your locale.

Default Dismiss

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

6 direct · 5 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-hovered
  • data-pressed
Usage
<Alert className="data-hovered:opacity-90 shadow-sm" />

Used in blocks

Related components