Skip to content

Feedback

Alert

A message about the page, in place.

When to reach for it

Something the reader needs to see and may need to act on. Something they only need to notice is a Toast.

Examples

tones

Read-only mode

A migration is running; edits are paused until it finishes.

Deployed

misoto22-site is live at commit a1b2c3d.

Token expires in 6 days

Rotate it before the next release.

Notes

A message about the page, in place.

Carries role="alert" for the danger tone and role="status" for the rest, which is the difference between interrupting the reader and waiting for a pause. Getting that backwards is the usual accessibility failure here: a "saved" toast that talks over someone mid-sentence, or a payment error that is never announced at all.

The tone is the message's SEVERITY, not its decoration. Colour is doubled by an icon and by the words, so the meaning survives both monochrome printing and colour-blindness.

Props

Alert props
PropTypeDefaultDescription
actionReactNodeOptional action — a retry, a link to the settings that fix this.
childrenReactNode
hideIconbooleanfalseHides the leading icon for a dense inline notice.
titleReactNode
toneAlertTone'info'

Also accepts everything in Omit<HTMLAttributes<HTMLDivElement>, 'title'>. Those are forwarded to the underlying element and are not listed row by row.

Types

export type AlertTone = 'info' | 'success' | 'warning' | 'danger'

Accessibility

  • danger is role="alert" and interrupts; the other three are role="status" and wait for a pause.
  • Colour is doubled by an icon and by the words.