- Docs
- Components
- 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
// 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.
| Prop | Type | Default | What 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. |
title | ReactNode | required | What happened, in a few words. |
children | ReactNode | — | Why, and what to do. |
actions | ReactNode | — | Buttons or links; a banner's at its end. |
icon | IconSource | the tone's | In 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-slot | Element | What 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. |