- 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
Playground
Every prop, live, and the code it takes.
Warning: Directory sync is behind
Users added in the last hour may be missing.
Tone
Variant
import { Alert } from "@qeetrix/react/experimental";
<Alert
title="Directory sync is behind"
tone="warning"
>
Users added in the last hour may be missing.
</Alert>02
Tones
The icon and a hidden word carry the tone ("Warning:"), never colour alone.
Information: You're in Development
Sign-ins here don't reach production.
Success: Directory synced
1,284 users are up to date.
Warning: Directory sync is behind
Users added in the last hour may be missing.
Error: Directory sync failed
Azure AD rejected the client secret.
<Alert tone="info" title="You're in Development">Sign-ins here don't reach production.</Alert>
<Alert tone="success" title="Directory synced">1,284 users are up to date.</Alert>
<Alert tone="warning" title="Directory sync is behind">Users added in the last hour may be missing.</Alert>
<Alert tone="danger" title="Directory sync failed">Azure AD rejected the client secret.</Alert>03
With actions
actions under the text: one primary at most.
Error: Directory sync failed
The last three attempts timed out.
<Alert
tone="danger"
title="Directory sync failed"
actions={
<>
<Button size="sm">Retry sync</Button>
<Button size="sm" variant="ghost" tone="neutral">View details</Button>
</>
}
>
The last three attempts timed out.
</Alert>04
Dismiss
onDismiss adds a Dismiss button. You decide whether the alert comes back.
Success: Directory synced
1,284 users are up to date.
<Alert tone="success" title="Directory synced" onDismiss={() => setShown(false)}>
1,284 users are up to date.
</Alert>05
Your own icon
icon, in place of the tone's: an eye for viewing as someone else.
Warning: You're viewing as Priya Sharma
Anything you change is done as her.
Information: The signing key rotates in 7 days
<Alert tone="warning" icon={EyeIcon} title="You're viewing as Priya Sharma">
Anything you change is done as her.
</Alert>07
After something happens
announce: "urgent" interrupts (role="alert") for an error that blocks the task; "polite" waits its turn. Only for an alert that appears.
{failed && (
<Alert tone="danger" title="Directory sync failed" announce="urgent">
Azure AD rejected the client secret.
</Alert>
)}08
In Hindi
QeetrixProvider's messages: the hidden tone word and Dismiss.
चेतावनी: डायरेक्टरी सिंक पीछे है
पिछले एक घंटे में जोड़े गए उपयोगकर्ता शायद नहीं दिखें।
<QeetrixProvider messages={hi}>
<Alert tone="warning" title="डायरेक्टरी सिंक पीछे है" onDismiss={dismiss}>…</Alert>
</QeetrixProvider>