Feedback
Alert & Banner
Messages about the state of something — inline in content, or as a full-width page banner. Announced only when you ask.
import { Alert, Banner } from '@reactloom/ui';Examples
Tones
Each tone has its own icon, so colour is never the only signal.
New version available
Payment received
Trial ends in 3 days
Card declined
import { Alert, Button, Stack } from '@reactloom/ui';
export default function Example() {
return (
<Stack gap="3" style={{ width: '100%', maxWidth: 560 }}>
<Alert title="New version available">Reload to get the latest features.</Alert>
<Alert tone="success" title="Payment received">Invoice INV-2041 is paid.</Alert>
<Alert tone="warning" title="Trial ends in 3 days" actions={<Button size="sm">Upgrade</Button>}>
Add a payment method to keep your workspace.
</Alert>
<Alert tone="danger" title="Card declined">Update the card ending 4242.</Alert>
</Stack>
);
}Announced alert
live="polite" announces alerts that appear after an action.
import { Alert, Button, Stack } from '@reactloom/ui';
import { useState } from 'react';
export default function Example() {
const [saved, setSaved] = useState(false);
return (
<Stack gap="3" style={{ width: '100%', maxWidth: 480 }}>
<Button onClick={() => setSaved(true)} disabled={saved}>Save settings</Button>
{/* Appears in response to an action: announce it politely. */}
{saved && (
<Alert tone="success" live="polite" onDismiss={() => setSaved(false)}>
Settings saved.
</Alert>
)}
</Stack>
);
}Banner
import { Banner, Button } from '@reactloom/ui';
export default function Example() {
return (
<div style={{ width: '100%' }}>
<Banner tone="warning" actions={<Button size="sm" variant="secondary">Status page</Button>}>
Read-only mode: scheduled maintenance until 03:00 UTC.
</Banner>
</div>
);
}API reference
| Prop | Type | Default |
|---|---|---|
tone | 'info' | 'success' | 'warning' | 'danger' | 'info' |
title | ReactNode | — |
iconReplace or hide the tone icon. | ReactNode | null | — |
actionsButtons or links. | ReactNode | — |
liveoff: static; polite: role=status; assertive: role=alert. | 'off' | 'polite' | 'assertive' | 'off' |
onDismissShows a dismiss button. | () => void | — |
dismissLabel | string | 'Dismiss' |
variantBanner is the banner variant. | 'inline' | 'banner' | 'inline' |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-tone] | info · success · warning · danger |
[data-variant] | inline · banner |
Theme tokens it reads
--pl-color-bg-inverse --pl-color-bg-subtle --pl-color-border-default --pl-color-danger-border --pl-color-danger-fg --pl-color-danger-on-solid --pl-color-danger-solid --pl-color-danger-subtle --pl-color-fg-default --pl-color-fg-inverse --pl-color-fg-muted --pl-color-info-border --pl-color-info-fg --pl-color-info-on-solid --pl-color-info-solid --pl-color-info-subtle --pl-color-success-border --pl-color-success-fg --pl-color-success-on-solid --pl-color-success-solid --pl-color-success-subtle --pl-color-warning-border --pl-color-warning-fg --pl-color-warning-on-solid --pl-color-warning-solid --pl-color-warning-subtle --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-md --pl-radius-lg --pl-radius-md
Accessibility
- Alerts present at page load are not announced (live="off"), avoiding noise.
- Use live="assertive" only for urgent, time-sensitive errors.
- Dismiss buttons are labelled; move focus sensibly after dismissal.
| Key | Action |
|---|---|
| Tab | Reach actions and dismiss |
Usage guidelines
Do
- Write the title as the outcome: “Payment received”.
- Offer a next step in actions.
Don’t
- Don’t stack several banners.
- Don’t auto-dismiss alerts that contain actions.