On this page

InstallationAnatomyColorsSizesWithout a titleA badge by the titleActionsCloseIn a narrow placeIn a row of controlsA link in the paragraphThe iconIn a cardIn the dashboardAccessibilityAPI ReferenceAlertAn actionRulesWritten down

Alert

The one banner: a message in a box of its color, with an optional title, up to two actions and an optional close.

2 policy violations
Two agents act without the verification this workspace requires.
1<Alert2  color="warning"3  title="2 policy violations"4  action={<Button>View details</Button>}5  secondaryAction={<Button>Learn more</Button>}6  onClose={dismiss}7>8  Two agents act without the verification this workspace requires.9</Alert>

Installation

import { Alert } from "@catalog-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.

SizeTextAt the sidesAbove and under textUnder a boxed buttonCornersIconA button
md13px, body-216px12px16px12px14px, 12px from the textsm, 28px
sm12px, body-312px8px12px8px12px, 8px from the textxs, 24px
inline12px, body-312px8pxnone8px12px, 8px from the textxs, 24px

Colors

Seven, the Badge's. A color sets the fill, the edge, the title's and the paragraph's colors, and the icon.

Scheduled maintenance
The gateway restarts on Sunday at 02:00 UTC.
Upgrade to Team
Get more capacity and controls for your organization.
Gateway connected
Traffic is flowing through eu-west-1.
2 policy violations
Two agents act without the verification this workspace requires.
Could not reach the gateway
The last three health checks failed.
A new version is available
Version 2.4 adds per-run quotas.
Judges are in preview
Rulings may change before release.
1<Alert color="neutral" title="Scheduled maintenance">The gateway restarts on Sunday at 02:00 UTC.</Alert>2<Alert color="primary" title="Upgrade to Team">Get more capacity and controls for your organization.</Alert>3<Alert color="success" title="Gateway connected">Traffic is flowing through eu-west-1.</Alert>4<Alert color="warning" title="2 policy violations">Two agents act without the verification this workspace requires.</Alert>5<Alert color="error" title="Could not reach the gateway">The last three health checks failed.</Alert>6<Alert color="info" title="A new version is available">Version 2.4 adds per-run quotas.</Alert>7<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.

A new version is available
Version 2.4 adds per-run quotas.
A new version is available
Version 2.4 adds per-run quotas.
1<Alert color="info" title="A new version is available" action={<Button>Update</Button>}>Version 2.4 adds per-run quotas.</Alert>2<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.

Changes apply to new runs only.
Runs could not be loaded. This is likely temporary.
1<Alert color="neutral">Changes apply to new runs only.</Alert>2<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.

JudgesPreview
Rulings may change before release.
1<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.

Upgrade to Team
Get more capacity and controls for your organization.
No agents registered. Register your first agent to get started.
A payment is past due
Update your payment method to avoid an interruption in access.
1<Alert color="primary" title="Upgrade to Team" action={<Button>Upgrade to Team</Button>} secondaryAction={<Button>Compare plans</Button>}>2  Get more capacity and controls for your organization.3</Alert>4<Alert color="info" action={<Button emphasis="link">Register agent</Button>}>5  No agents registered. Register your first agent to get started.6</Alert>7<Alert color="error" title="A payment is past due" action={<Button>Update payment method</Button>}>8  Update your payment method to avoid an interruption in access.9</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.

2 tools need attention
Unhealthy tools: github, linear.
1<Alert color="error" title="2 tools need attention" action={<Button>View tools</Button>} onClose={dismiss}>2  Unhealthy tools: github, linear.3</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.

Dome stopped this schedule
Fix the cause, then resume.
2 policy violations
Two agents act without the verification this workspace requires.
1{/* 360px wide: the actions are under the text. */}2<Alert color="error" title="Dome stopped this schedule" action={<Button>Resume schedule</Button>} secondaryAction={<Button>Learn more</Button>}>3  Fix the cause, then resume.4</Alert>5 6<Alert stacked color="warning" title="2 policy violations" action={<Button>View details</Button>}>7  Two agents act without the verification this workspace requires.8</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.

Agent limit reached
1<Alert inline color="primary" action={<Button emphasis="link">Upgrade to register more</Button>}>Agent limit reached</Alert>2<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.

6 resources aren't attached to a Gateway
Agents and people can't reach them until you attach them: 3 tools, 2 models, 1 pool.
1<Alert color="info" title="6 resources aren't attached to a Gateway">2  Agents and people can't reach them until you attach them: <TextLink href="#tools">3 tools</TextLink>,{" "}3  <TextLink href="#models">2 models</TextLink>, <TextLink href="#pools">1 pool</TextLink>.4</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.

Gateway connected
Traffic is flowing through eu-west-1.
Gateway connected
Traffic is flowing through eu-west-1.
Gateway connected
Traffic is flowing through eu-west-1.
1<Alert color="success" title="Gateway connected">Traffic is flowing through eu-west-1.</Alert>2<Alert color="success" icon={Globe} title="Gateway connected">Traffic is flowing through eu-west-1.</Alert>3<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.

Act-as is required by workspace policy: this agent verifies through one of Okta, Entra ID.

Verification method: JWT

1<Card>2  <CardContent padding="md" className="flex flex-col gap-3">3    <Alert color="info">Act-as is required by workspace policy: this agent verifies through one of Okta, Entra ID.</Alert>4    <p className="text-body-2 text-neutral-fg-secondary">Verification method: JWT</p>5  </CardContent>6</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…).

PropTypeDefaultDescription
color"neutral" | "primary" | "success" | "warning" | "error" | "info" | "fuchsia""neutral"What kind of message it is.
size"md" | "sm""md"13px text, or 12px.
stackedbooleanfalseKeeps the actions under the text at any width.
inlinebooleanfalseAs wide as its words and 32px high, for a row of controls.
iconIconComponent | null—Another icon than the color's own, or none.
titleReactNode—One short line above the paragraph.
badgeBadgeSpec—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.
childrenReactNode—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.

PropTypeDefaultDescription
childrenReactNode—The Button's words.
iconStartIconComponent—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.

Catalog
Foundations
  • Overview
  • Tokens
  • Token usage
  • Typography
  • Icons
Atoms
  • Avatar
  • Badge
  • Button
  • Checkbox
  • Color picker
  • Copy button
  • Icon tooltip
  • Inline code
  • Input
  • Hint
  • Kbd
  • Loader
  • Native select
  • Progress bar
  • Progress ring
  • Radio
  • Select
  • Status dot
  • Switch
  • Text link
  • Textarea
  • Tooltip
  • Truncate
Molecules
  • Accordion
  • Activity chart
  • AI elements
  • Alert
  • Button group
  • Card
  • Code block
  • Combobox trigger
  • Command
  • Context switcher
  • Dropdown menu
  • Empty state
  • Field
  • Field group
  • Filter chip
  • Flow
  • Icon picker
  • Metric card
  • Modal
  • Modal confirmation
  • Pagination
  • Popover
  • Scroll area
  • Sidebar
  • Table
  • Tabs
  • Toggle group
LibraryPublished release