Skip to content
GitHub (opens in a new tab)

Alert

Inline status banner that stays on the page.

stableMoleculecontracts/alert.json

Preview

Alert

Status message that stays on the page until it is fixed or dismissed. Not a toast.

Master

Info on the page, with the tinted fill. Variants shows each tone.

Heads up

Invoices export overnight. You will get an email when the file is ready.

Usage

Put it above the part of the page it is about. It stays until the problem is fixed or dismissed. Use Toast after an action, Badge for a compact chip and AlertDialog when they must choose.

Do's

  • Page or form feedback the user should still see after it appears
  • Success, warning, or danger copy tied to the current view

Don'ts

  • Transient confirmations that disappear — not a toast; ask before adding one
  • Compact status chips — use Badge
  • Dismissible overlay — use Modal
  • Must-choose overlay confirm — use AlertDialog
  • A dismissible insight tile — use InsightCard
<Alert variant="info" title="Heads up">
  Invoices export overnight. You will get an email when the file is ready.
</Alert>

When to use

  • Page or form feedback the user should still see after it appears
  • Success, warning, or danger copy tied to the current view

When not to use

  • Transient confirmations that disappear — not a toast; ask before adding one
  • Compact status chips — use Badge
  • Dismissible overlay — use Modal
  • Must-choose overlay confirm — use AlertDialog
  • A dismissible insight tile — use InsightCard

What an agent reads

import { Alert } from "agentic-ds-kit";
must
  • info, success and warning use role=status (a warning on page load is not urgent)
  • danger uses role=alert
  • The header starts with the tone word (Info, Success, Warning, Error from KitLabelsProvider keys info, success, warning, danger), then · eyebrow, so status is never colour alone
  • Title uses the -fg tone and body uses text.primary (4.5:1 or more on the tinted fill); the icon keeps the status colour
  • Dismiss is a kit Button named Dismiss (KitLabelsProvider); focus never jumps to the alert
  • Actions are kit Buttons, so they stay keyboard reachable in reading order after the text
  • An action icon (action.icon, secondaryAction.icon) is decorative and aria-hidden; the label still names the action, so never pass an icon without a label
defaults
  • variant info
  • placement page
stops if
  • Do not invent local Alert, Banner, or Callout
  • Do not use raw hex
  • Do not use Alert for toast-style popups
  • Do not pass actions as ReactNode slots — use action and secondaryAction
  • Do not use more than two actions in one Alert

From contracts/alert.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
variantinfo | success | warning | dangerNoinfo—
titlestringNo——
childrenstringNo—Optional: leave it out when the title says it all, like an error summary.
placementinline | pageNopagepage: tinted fill, for a problem that affects the whole page or account; put it above the content it is about. inline: neutral card surface with the status shown by the icon, for something in one part of the page. The header (tone word, eyebrow, timestamp, Dismiss) always shows on inline; on page it shows when eyebrow, timestamp or onDismiss is set.
eyebrowstringNo—Short context word after the tone word in the header, like Billing in Warning · Billing.
timestampstringNo—Preformatted time on the right of the header, like Nov 20 or 09:41.
actionobjectNo—One kit Button under the text. page: solid primary (counts as the view's one primary), or outline neutral with appearance "outline" when the page already has its primary (an error summary above a form with Save). inline: outline neutral.
secondaryActionobjectNo—kit Button outline neutral, after action.
onDismissfunctionNo—() => void. Shows a Dismiss kit Button on the right of the header. Leave it out while the problem is still real.
  • Component
    →

    Badge

    Compact read-only status or category pill set by the system.

  • Component
    →

    Modal

    Dismissible overlay for short tasks, forms, or extra detail.

  • Component
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.

  • Component
    →

    InsightCard

    A recommended insight or opportunity as a compact card, with tone and optional actions.