Skip to main content
  1. Docs
  2. Components
  3. Feedback

Alert

A message in the page: above a form, in a card, or across the top as a banner. It never takes focus, and never goes by itself.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<div>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

alert.tsx
// Experimental: from the package's experimental entry, until it's stable.
import { Alert } from "@qeetrix/react/experimental";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
tone"info" | "success" | "warning" | "danger""info"The icon and a hidden word carry it, never colour alone.
variant"default" | "banner""default"In the page; or a banner about the whole app, one line across it.
titleReactNoderequiredWhat happened, in a few words.
childrenReactNode—Why, and what to do.
actionsReactNode—Buttons or links; a banner's at its end.
iconIconSourcethe tone'sIn place of the tone's icon.
onDismiss() => void—Adds Dismiss. Whether it comes back is yours.
announce"polite" | "urgent"—Only for an alert that appears: role="status", or role="alert" to interrupt.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
alert<div>data-tone, data-variant; role only with announce.
alert-icon<svg>aria-hidden.
alert-body<div>The text and the actions.
alert-title<div>With the hidden tone word.
alert-description<div>The children.
alert-actions<div>The actions.

04

Banners in the app shell

AppShell's banners hold page banners, under the top bar and above everything else.

console.tsx
import { Alert, AppShell } from "@qeetrix/react/experimental";

<AppShell banners={impersonating && <Alert variant="banner" tone="warning" icon={EyeIcon} title="You're viewing as Priya Sharma" />} …>
  …
</AppShell>
Next — AlertAccessibility