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

Banner

  • Stable
  • WCAG 2.2 evidence
  • RTL

A page-wide notice across the top of a page or app shell: tone icon, message, optional link and close button on a solid fill. A status region (role="status", or role="alert" when politeness="assertive"), so a banner that appears is announced (WCAG 4.1.3); the tone has its own icon with 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: wording, urgency (politeness), removing the banner and moving focus in onDismiss. A sticky banner must not hide the focused element: give the page scroll-padding-top equal to the banner height (WCAG 2.4.11). Use Alert for feedback about one section and Toast for transient confirmations.

import { Banner } from "@nexera-ui/react";
Loading example…
6
examples
7
props
2
live controls
1
platform
12
WCAG criteria
2
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…
tone
politeness
Generated code
import { Banner } from "@nexera-ui/react";

<Banner />

Examples 5

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

Tones

Every Tone in a fluid container; each has its own icon and a visually hidden text alternative.

Loading example…

Dismissible

The consumer removes the banner in onDismiss (and would remember the choice), then moves focus to the main heading because the focused close button disappears.

Loading example…

Long message

A long message wraps with the link at its end (translation adds 30 to 40 %); the close button stays at the end.

Loading example…

Sticky

A sticky banner at the top of a scrolling page. The page sets scroll-padding-top to the banner height, so focused elements scrolled into view are never hidden under it (WCAG 2.4.11).

Loading example…

Right to left

Right-to-left: the icon and message start on the right; the close button sits at the left end.

Loading example…

Props 7

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

7 props shown

message*Nexera
ReactNode

The notice, for example "Payroll v2 is rolling out this week." Say what happened and what to do next. Wraps, never truncated.

Default –
toneNexera
"info" | "warning" | "danger" | "brand"

Colour set and icon: info, warning and danger notices, or brand for product news.

Default info
actionNexera
ReactNode

Link after the message, for example <a href="/payroll-v2">Learn more</a>. Links inside are underlined and get a focus outline in the banner's text colour.

Default –
politenessNexera
"polite" | "assertive"

How assistive technology announces the banner when it appears (WCAG 4.1.3): polite renders role="status", assertive renders role="alert" (urgent problems only). A banner 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 message followed by a colon ("Warning:..."). Translate it for your locale; pass "" when the message already states the severity.

Default "Info", "Warning", "Error"; none for `brand`
onDismissNexera
() => void

Shows the close button and is called without arguments when it is activated; accepts a Server Action. The banner does not hide itself: remove it in this callback (and remember the choice), and move focus somewhere sensible, 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 · 6 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.11Non-text ContrastLevel 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-focus-visible
  • data-hovered
  • data-pressed
Usage
<Banner className="data-focus-visible:opacity-90 shadow-sm" />

Used in blocks

Related components