Integrated ResearchPicasso
Components

Alert

Something the page needs to say about itself, in place — and that stays there.

{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}

Something the page needs to say about itself, in place — and that stays there.

Import

import { Alert, AlertTitle, AlertDescription } from "@ir/ui";

Watch out

  • The icon and the dismiss take fg/neutral/emphasis, the same ink as the title, in all four tones. That is Figma's spec, and it is why the tone has to be carried by the surface — do not tint the icon to compensate.
  • The icon and the dismiss live inside the title row, which is where Figma puts them, so they align with the title rather than floating against the middle of a two-line block. It also means an Alert with no AlertTitle has neither — again, Figma's shape, since both are children of the title row there. If a dismissible alert with no title is wanted, that is a change to the Figma component first.

Variants

AxisOptionsDefault
variantinfo · destructive · warning · successinfo

Props

PropTypeRequiredWhat it does
iconbooleanHide the tone icon. Figma's Icon boolean.
onDismiss() => voidRenders the dismiss control at the end of the title row.
dismissLabelstringLabel for the dismiss control — it is an ✕, so it needs words.
actionReact.ReactNodeThe trailing action, an xs Outline Button in Figma's Action=Button.

Do and don't

Use Toast for a passing confirmation; keep Alert for a condition that is still true.

Don't — Use an Alert for something that just happened and does not need to persist.

An Alert stays on the page. If the thing it describes is over, it becomes a piece of furniture people learn to read past.

Use a Dialog when the work genuinely cannot proceed.

Don't — Use an Alert to ask a question that must be answered before continuing.

An Alert can be ignored by design. A question that cannot be ignored needs a control that takes the focus.

Match the tone to the state: success happened, warning is about to, destructive already went wrong, info is context.

Don't — Reach for Destructive because the message feels important.

Four tones only work while they differ. A page of red alerts carries exactly as much information as a page of grey ones.

Say what happened and what happens next, and attach the action if there is one.

Don't — State the problem and stop — "Connection failed."

An alert that cannot be acted on is a notification. The description is where the reader finds out whether this is theirs to fix.

Offer dismiss for something acknowledged; leave a live condition on the page until it clears.

Don't — Let someone dismiss an alert describing a condition that is still true.

Dismissing is a promise that the information is no longer needed. If the disk is still full, closing the notice only hides it.

Don't — Stack four alerts at the top of a page.

A stack of alerts reads as a wall. Whichever is most urgent is the one least likely to be read.

Keep the title to a short phrase and put the rest in the description.

Don't — Write a title that wraps onto a second line.

The title shares its row with the icon and the dismiss. A wrapping title pushes them apart and stops the row reading as one thing.

Accessibility

  • No role by default, deliberately. role="alert" interrupts a screen reader mid-sentence — use it only for something that has just gone wrong, and role="status" for something that merely changed.
  • The leading icon is aria-hidden. Severity has to be in the words; colour and icon alone reach nobody using a screen reader.
  • The dismiss button's accessible name comes from dismissLabel. An X with no label announces nothing.

Where it is drawn

Figma — structure from figma, measurements from figma.

Open in Storybook

On this page