Alert

Reports a problem with the current view.

Status

  • Runs move to cold storage

    After 30 days.

    neutraldefault

  • Prompt v14 is live

    Every new conversation uses it.

    ok

  • Key expires tomorrow

    Rotate it before 09:00.

    warn

  • Eval failed on 4 tickets

    Open the run to see why.

    fail

Usage

When to use it
Use
Something about this view needs the person's attention: a key expiring, an eval that failed.
Use
Good news worth a line where it happened: a prompt went live.
Use
A note that is part of the page: retention, a limit, a change.
Not for
Where one run stands, in a row. Use Status.
Not for
A region has nothing to show or failed to load. Use Empty state.
Not for
A short label beside a name. Use Badge.

Rules

7 rules
Must
Name the thing in AlertTitle in words: "Production key expires tomorrow", never "Warning" or "Error". Because the tint and the icon already say how bad it is, so a title that repeats it leaves the person reading on to learn what.
Never
Give a warn or fail Alert a close button; it stays until the problem is fixed. Because a dismissed failure is still a failure, and AlertClose renders nothing on warn and fail anyway.
Must
Pick status by the news: fail for a failure, warn for a risk, ok for good news, neutral for a note. Because colour means status, so a coral note about retention reads as a failure.
Must
Put at most one secondary action in AlertAction, size="sm", and never an ink one. Because the alert sits inside a view that has its own ink action, and an ink pill on a tint fights it.
Never
Draw a coloured bar on one edge or a shadow under an Alert. Because a side rail is the generated-UI tell Glaze rules out, and the tint already says the status.
Should
Give a dismissible notice a dismissKey that changes with its message. Because the same notice then stays gone across visits, and a new one shows again.
Should
Set announce={false} on a note that is part of the page when it loads. Because a role="status" region on every page load reads the note to a screen reader each time.

Accessibility

4 checks
warn and fail are role="alert"; neutral and ok role="status"; announce={false} drops the role.
Each status has its own icon shape, so it reads in grayscale.
Words on the tints are 5.0:1 or better; the icon takes the status word colour.
Dismissing moves focus to the next focusable thing after the alert.

Keyboard

2 keys
Tab
Moves to the action, then the close button.
Enter
Presses the focused action or dismisses.

Edge cases

6 edge cases
Under 24rem
The action drops under the text.
No title
The icon centres on the description's first line.
Dismissed before
Never flashes in: it waits for the stored dismissal.
No children
Renders nothing.
Dark theme
The tints turn dark and the words light.
Forced colours
A CanvasText border keeps the box.

API

6 props
status
'neutral' | 'ok' | 'warn' | 'fail' default 'neutral'
icon
boolean | ReactNode default true
announce
boolean default true
dismissKey
string
onDismiss
() => void
AlertClose label
string default 'Dismiss'

Tokens

14 tokens
--paper
#ffffff
--line
rgb(5 5 5 / 0.10)
--ok-tint
#e6f4ea
--warn-tint
#fbf0d9
--fail-tint
#fbe9e5
--ok-text
#1a7640
--warn-text
#8a5a00
--fail-text
#b23c29
--text-1
rgb(5 5 5 / 0.80)
--text-2
rgb(5 5 5 / 0.60)
--radius-overlay
10px
--space-3
12px
--type-label
500 13px/1.35 var(--font-sans)
--type-body-sm
400 13px/1.5 var(--font-sans)

Install

For your coding agent

GitHub

Please star me pookie

141

A new design system every week

Leave your email before you copy the prompt.