Alert
The one banner: a message in a box of its color, with an optional title, up to two actions and an optional close.
<Alert color="warning" title="2 policy violations" action={<Button>View details</Button>} secondaryAction={<Button>Learn more</Button>} onClose={dismiss}> Two agents act without the verification this workspace requires.</Alert>Installation
import { Alert } from "@dome-systems/ds-dashboard/components";Anatomy
The title is a label one step above the paragraph, in the color's text color; the paragraph is one step quieter. The padding is 4px less above and under than at the sides: a line of text brings its own air over its capitals, so the words sit as far from the top as from the left. A boxed button has no such air, so the box keeps the side's padding under one.
| Size | Text | At the sides | Above and under text | Under a boxed button | Corners | Icon | A button |
|---|---|---|---|---|---|---|---|
md | 13px, body-2 | 16px | 12px | 16px | 12px | 14px, 12px from the text | sm, 28px |
sm | 12px, body-3 | 12px | 8px | 12px | 8px | 12px, 8px from the text | xs, 24px |
inline | 12px, body-3 | 12px | 8px | none | 8px | 12px, 8px from the text | xs, 24px |
Colors
Seven, the Badge's. A color sets the fill, the edge, the title's and the paragraph's colors, and the icon.
<Alert color="neutral" title="Scheduled maintenance">The gateway restarts on Sunday at 02:00 UTC.</Alert><Alert color="primary" title="Upgrade to Team">Get more capacity and controls for your organization.</Alert><Alert color="success" title="Gateway connected">Traffic is flowing through eu-west-1.</Alert><Alert color="warning" title="2 policy violations">Two agents act without the verification this workspace requires.</Alert><Alert color="error" title="Could not reach the gateway">The last three health checks failed.</Alert><Alert color="info" title="A new version is available">Version 2.4 adds per-run quotas.</Alert><Alert color="fuchsia" title="Judges are in preview">Rulings may change before release.</Alert>Sizes
Two, by their text: md, the default, is 13px; sm is 12px, with a smaller icon. What each measures is in the table under Anatomy.
<Alert color="info" title="A new version is available" action={<Button>Update</Button>}>Version 2.4 adds per-run quotas.</Alert><Alert size="sm" color="info" title="A new version is available" action={<Button>Update</Button>}>Version 2.4 adds per-run quotas.</Alert>Without a title
The paragraph is always there; the title is not. Alone, the paragraph keeps its own color, and the icon takes it.
<Alert color="neutral">Changes apply to new runs only.</Alert><Alert color="error" action={<Button emphasis="low">Retry</Button>}>Runs could not be loaded. This is likely temporary.</Alert>A badge by the title
badge takes what a Badge takes. It is drawn in the Alert's color at high emphasis unless it says otherwise.
<Alert color="fuchsia" title="Judges" badge={{ label: "Preview" }}>Rulings may change before release.</Alert>Actions
Two at most, and each is a Button you pass in, with every prop of its own: its label, iconStart, loading, disabled, onClick, render for a link. The Alert has no copy of them. It only presets what the Button leaves unset: its own color, the emphasis of the place (action is solid, secondaryAction is a ghost) and the size. The second is never solid, so an Alert has one solid button at most.
<Alert color="primary" title="Upgrade to Team" action={<Button>Upgrade to Team</Button>} secondaryAction={<Button>Compare plans</Button>}> Get more capacity and controls for your organization.</Alert><Alert color="info" action={<Button emphasis="link">Register agent</Button>}> No agents registered. Register your first agent to get started.</Alert><Alert color="error" title="A payment is past due" action={<Button>Update payment method</Button>}> Update your payment method to avoid an interruption in access.</Alert>Close
onClose shows the close, on the first line of text, and is called when it is pressed. The Alert holds no dismissed state: its caller stops drawing it.
<Alert color="error" title="2 tools need attention" action={<Button>View tools</Button>} onClose={dismiss}> Unhealthy tools: github, linear.</Alert>In a narrow place
The actions sit at the right. Once the Alert is narrower than 480px they go under the text by themselves, the main one first. stacked keeps them under the text at any width.
{/* 360px wide: the actions are under the text. */}<Alert color="error" title="Dome stopped this schedule" action={<Button>Resume schedule</Button>} secondaryAction={<Button>Learn more</Button>}> Fix the cause, then resume.</Alert>
<Alert stacked color="warning" title="2 policy violations" action={<Button>View details</Button>}> Two agents act without the verification this workspace requires.</Alert>In a row of controls
inline makes it as wide as its words and 32px high, a header control's height: 12px text on one line, its action a link.
<Alert inline color="primary" action={<Button emphasis="link">Upgrade to register more</Button>}>Agent limit reached</Alert><Button color="primary" emphasis="high" disabled>Register agent</Button>A link in the paragraph
The paragraph is colored already, so color cannot mark a link in it: a TextLink there is underlined, and keeps the paragraph's color. Under the pointer it takes the title's. The Alert sets that for every link it holds. What would be a third action is written this way.
<Alert color="info" title="6 resources aren't attached to a Gateway"> Agents and people can't reach them until you attach them: <TextLink href="#tools">3 tools</TextLink>,{" "} <TextLink href="#models">2 models</TextLink>, <TextLink href="#pools">1 pool</TextLink>.</Alert>The icon
Each color has its own, on the first line of text and in that line's color. icon takes another, or null for none.
<Alert color="success" title="Gateway connected">Traffic is flowing through eu-west-1.</Alert><Alert color="success" icon={Globe} title="Gateway connected">Traffic is flowing through eu-west-1.</Alert><Alert color="success" icon={null} title="Gateway connected">Traffic is flowing through eu-west-1.</Alert>In a card
It sits inside the card's padding, like anything else the card holds. It never runs edge to edge across a card.
Verification method: JWT
<Card> <CardContent padding="md" className="flex flex-col gap-3"> <Alert color="info">Act-as is required by workspace policy: this agent verifies through one of Okta, Entra ID.</Alert> <p className="text-body-2 text-neutral-fg-secondary">Verification method: JWT</p> </CardContent></Card>In the dashboard
New, not used by a screen yet. A banner is drawn 78 separate times in the dashboard today, in 16 looks: the old shared Alert (components/reui/alert.tsx) in 28 places, other shared pieces in 8, and by hand in 42. Replacing them with this component is the next change.
Accessibility
An error Alert has the role alert, so a screen reader says it at once. Every other color has the role status, said when the reader is idle. Pass role to change either.
The close is a button named Dismiss. An action is a Button, so the Tab key reaches it; under the text the main action comes first, and at the right it comes last, as it reads.
The color never carries the message alone: the icon and the words say it too.
API Reference
Alert
Besides these, the props of a <div> (role, className…).
| Prop | Type | Default | Description |
|---|---|---|---|
color | "neutral" | "primary" | "success" | "warning" | "error" | "info" | "fuchsia" | "neutral" | What kind of message it is. |
size | "md" | "sm" | "md" | 13px text, or 12px. |
stacked | boolean | false | Keeps the actions under the text at any width. |
inline | boolean | false | As wide as its words and 32px high, for a row of controls. |
icon | IconComponent | null | — | Another icon than the color's own, or none. |
title | ReactNode | — | One short line above the paragraph. |
badge | BadgeSpec | — | A badge after the title. |
action | <Button> | — | The main action, a Button. Solid, in the Alert's color, unless the Button says otherwise. |
secondaryAction | <Button> | — | A second, quieter action, a Button. A ghost unless the Button says otherwise. Never solid. |
onClose | () => void | — | Shows the close, and is called when it is pressed. |
children | ReactNode | — | The paragraph. |
An action
action and secondaryAction each take a Button, with every prop of its own (onClick, render, loading, disabled, tooltip). The Alert reads these, and presets the three it fills in where the Button leaves them unset.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The Button's words. |
iconStart | IconComponent | — | An icon before them. |
color | "neutral" | "primary" | "success" | "warning" | "error" | "info" | "fuchsia" | — | The Alert's own color, unless set. |
emphasis | "high" | "low" | "ghost" | "link" | — | high for the main action and ghost for the second, unless set. The second is never solid: asked high, it is drawn low. |
size | "md" | "sm" | "xs" | "xxs" | — | sm, or xs in a small Alert: a larger size is capped to it. |
Rules
Written down
A banner is the Alert
One component draws every banner, in a page, a card, a dialog or a page's header.
From ds/README.md (Alert).
Two actions at most, one of them solid
The main action is solid, in the Alert's color; the second is a ghost in that color. What would be a third action is a link in the paragraph.
From ds/README.md (Alert) and ds/components/alert.tsx.
It sits inside its card
An Alert in a card takes the card's padding around it. It does not run edge to edge.
From ds/README.md (Alert).
A link in its paragraph is underlined
In the paragraph's color, and the title's under the pointer. It is the one place a TextLink is underlined.
From ds/README.md (Text link) and ds/components/alert.tsx.