Skip to content

Components · Status and feedback

Alert

Inline message about a page or section.

@rookcom/monarch-reactComponent

Tones

Sync scheduled

Rook ID members refresh every 15 minutes.

Saved

Domain not verified

Usage examples

The example at the top of the page is the only one for this component.

Purpose

An inline message about the state of a page or section, with an optional title, body and actions.

Use when

  • Explaining a condition that affects the current view (sync paused, domain not verified).

Avoid when

  • Transient confirmation of an action: use Toast.
  • Nothing to show yet: use EmptyState.
  • A one-line note next to a field, row or card: use InlineNotice.
  • A banner across the page or app (trial, maintenance, billing) or one the user can dismiss: use CalloutBanner.

Design principles

  • Silent by default: only alerts that appear in response to a user action set live.
  • assertive only for errors that block progress.
  • Each tone has a default icon; replace it with icon or pass null for none.

API reference

import { Alert } from '@rookcom/monarch-react';
ExportKindRenderingRoot class
Alertcomponentserver-safe.mn-alert

All native <div> attributes pass through; an explicit role wins over the one derived from live.

Generated from the TypeScript declarations of packages/react/src/components/feedback/alert.

Properties

Alert

Inline message about the state of a page or section.

PropTypeDescription
actionsReactNodeActions on the trailing edge, e.g. a Button or a dismiss IconButton.
childrenReactNode
classNamestring
iconReactNodeReplaces the default tone icon. Pass `null` for none.
idstring
live"polite" | "assertive"Set when the alert appears in response to something the user did, so it is announced. `assertive` only for errors that block progress.
titleReactNode
tone"danger" | "success" | "warning" | "neutral" | "info"

Variants

PropValuesDescription
tone'neutral''info''success''warning''danger'Colour and default icon. Default info. Exposed as data-tone.
live'polite''assertive'polite sets role="status", assertive sets role="alert"; unset means no live role.

States

StateExposed asBehaviour
Static–No interactive states; actions keep their own.

Interaction behaviour

  • None of its own. Buttons passed in actions render on the trailing edge.

Keyboard support

Not interactive itself; focus moves to controls inside actions.

Accessibility

Role
none, status (live="polite") or alert (live="assertive")
Accessible name
–
  • The tone icon is aria-hidden; the title and body carry the message.
  • A live role makes screen readers announce the alert when it appears.

Responsive behaviour

  • No breakpoints: the alert fills its container width.

Theme support

  • Each tone uses its subtle, strong and border tokens, so all themes apply.

Do and don't

Do

  • Set live when the alert appears because of something the user did.
  • Offer the fixing action in actions.

Don't

  • Do not make static page alerts live; they would be announced on every render.
  • Do not use assertive for information that does not block the user.
  • Toast: Transient feedback after an action.
  • CalloutBanner: Page- or app-level banner (trial, maintenance, billing, scope), dismissible and optionally a landmark.
  • InlineNotice: One line attached to a field, row or card; no body block. Use Alert when the message needs a title and a paragraph.

Dependencies

KindDepends on
npm packagesNone
Monarch componentsNone

Testing coverage

  • Announces only when live is set (status / alert).
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesVisual baselines: /__gallery

Tests: packages/react/src/components/feedback/alert