Alert

Alert shows a message inside the page, next to the content it is about. Use it for information people should see in context.

  • Beta
  • Accessibility
  • Figma Alert reference matrix (owner, 2026-10-14); Alert, Notification and Toast 3806:36330
  • packages/ui/src/components/Alert

Built from the owner's alert reference (2026-10-14): five statuses, four appearances and three sizes. Beta until the matrix is in Figma and design confirms the contrast adjustments listed below. Everything on this page is implemented and tested.

Preview

Change the controls to try every supported combination. The preview uses role="none" so changing controls doesn't announce anything.

Information: What’s a space?

Space keeps chats, documents, and videos in one place for better organization and efficient learning.
Learn more
tsx
import { Alert, AlertAction } from '@nuton/ui'

<Alert
  status="information"
  size="large"
  title="What’s a space?"
  description="Space keeps chats, documents, and videos in one place for better organization and efficient learning."
  dismissible
  actions={<>
    <AlertAction onClick={openSpaces}>Open spaces</AlertAction>
    <AlertAction href="/help/spaces">Learn more</AlertAction>
  </>}
/>

Installation

Availability

@nuton/ui and @nuton/tokens are private workspace packages and aren't published yet (D4, D12). Inside the Nuton monorepo, add them as workspace dependencies.

bash
pnpm add @nuton/ui @nuton/tokens @remixicon/react
tsx
import '@nuton/tokens/tokens.css'
import '@nuton/ui/styles.css'

Usage

tsx
import { Alert } from '@nuton/ui'

<Alert
  title="What’s a space?"
  description="Space keeps chats, documents, and videos in one place for better organization and efficient learning."
/>
  • Place the alert next to what it's about: at the top of a form, a lesson or a settings group.
  • Keep the title short. Put the detail in the description, and one or two next steps in actions as AlertActions.
  • Pick the size by content: xsmall or small for one line (a banner, a toast), large when there's a description. Without size, an alert with a description is large and one without is small.
  • Pick the appearance by emphasis: filled for the strongest, light and lighter for most in-page alerts, stroke on tinted surfaces or for toasts.
  • Pick the status by meaning, not colour: error for something that failed, warning for a risk, success for a finished task, information or neutral for help.
  • For a short confirmation after an action, use a Toast. For a decision that blocks the page, use a Modal.

Variants and sizes

Five statuses (rows) in four appearances (columns), in three sizes. This is the owner's reference matrix, built with Nuton tokens.

X-small

One line, 32 tall: 16px icon, Paragraph/X Small text, Label/X Small action, radius 8.

filled

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

light

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

lighter

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

stroke

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

Small

One line, 36 tall: 20px icon, Paragraph/Small text, Label/Small action, radius 8.

filled

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

light

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

lighter

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

stroke

Error: Insert your alert title here!

Success: Insert your alert title here!

Warning: Insert your alert title here!

Insert your alert title here!

Information: Insert your alert title here!

Large

Title, a description and actions under the text with a dot between them; padding 14, radius 12, close at the top end.

filled

Error: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Success: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Warning: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Information: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

light

Error: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Success: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Warning: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Information: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

lighter

Error: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Success: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Warning: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Information: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

stroke

Error: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Success: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Warning: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Information: Insert your alert title here!

Insert the alert description here. It would look better as two lines of text.

Examples on this page pass role="none" so the docs don't announce them on load. In your app, leave the default role.

Colours and contrast

Every text pair is at least 4.5:1 and every icon at least 3:1. Where the reference colours fell short, code uses the next step of the same hue.

AppearanceBackgroundTitle · descriptionIcon
FilledStrong step: red-700, green-800, orange-800, gray-600, Primary/Base (the badge rule, C47)White · white (4.93:1 or more)White
LightState/<status>/LightStrong-950 · gray-700 (Sub-600 is 4.33:1 on Error/Light)Strong step (3.40:1 or more)
LighterState/<status>/Lighter (neutral: Bg/Weak-50, the Figma frame)Strong-950 · Sub-600 (5.84:1 or more)Strong step (4.53:1 or more)
StrokeBg/White, 1px Stroke/Soft-200Strong-950 · Sub-600 (6.69:1)Strong step

Content options

Only the description, no title.

AI Tutor tip

Ask for a worked example of any formula.

States and interactions

Static

No close button.
StaticThe default. The alert stays until the app removes it.

Dismissible

Press × to hide it.
DismissibleHover shades the close target; focus shows a 2px ring (white on filled). Actions underline on hover.

Dismissing and focus

When the close button is pressed the alert disappears and focus would be lost. Use onDismiss to move focus somewhere sensible, such as the section heading.

Biology 101

Information: New lessons added

Two lessons on cell respiration are ready.

State tokens

Set on .nu-alert. Each status sets --nu-alert-strong, --nu-alert-light and --nu-alert-lighter; each appearance maps them to --nu-alert-bg, --nu-alert-border, --nu-alert-fg, --nu-alert-muted, --nu-alert-icon and --nu-alert-close; each size sets --nu-alert-radius, --nu-alert-pad-block, --nu-alert-pad-inline, --nu-alert-gap and the icon sizes.

Differences from the reference

  • Status icons are the Status Badge shapes (a second cue besides colour), not the reference's placeholder glyph.
  • Filled backgrounds and some icons use a stronger step of the hue so text and icons pass contrast (table above).
  • The close button is a 24 × 24 target around the 16 or 20px icon (WCAG 2.5.8).
  • Descriptions use Nuton's Paragraph/Small 24px line height.

Composition examples

Error after submit

An error alert at the top of a form uses role="alert" by default, so screen readers announce it straight away.

API reference

Props

Alert props
PropTypeDefaultDescription
status'error' | 'success' | 'warning' | 'neutral' | 'information''neutral'Colour, icon, status word and default role.
appearance'filled' | 'light' | 'lighter' | 'stroke''lighter'Emphasis: solid, tint, pale tint, or white with a border.
size'xsmall' | 'small' | 'large'large with a description, else smallxsmall and small are one line; large adds the description and puts actions under it.
titleReactNode—The message. Label/Small in large; regular weight in the one-line sizes.
descriptionReactNode—Supporting text (large). children is used when omitted. In one-line sizes it becomes the line when there is no title.
actionsReactNode—AlertActions. Large: under the text with a dot between. One-line: at the end of the line.
iconReactNode | false—Replaces the status icon; false hides it. Decorative (aria-hidden).
statusLabelstring | false—Word read before the title by screen readers. Defaults: Information, Success, Warning, Error; none for neutral.
dismissiblebooleanfalseShows the close button. The alert hides itself when pressed.
onDismiss() => void—Called after the alert hides. Move focus here.
dismissLabelstring'Dismiss'Accessible name of the close button.
role'alert' | 'status' | 'none'error → 'alert', else 'status'Live-region role. none renders no role, for static notices.
…div propsHTMLAttributes<HTMLDivElement>—className, id and other attributes go to the container. The ref points at it.
AlertAction props
PropTypeDefaultDescription
hrefstring—Renders a link; without it, a button.
childrenrequiredReactNode—The action label, e.g. “Learn more”.
…button or anchor propsButtonHTMLAttributes | AnchorHTMLAttributes—onClick, target and other attributes. Text takes the alert colour; it underlines on hover.

Accessibility

Keyboard

KeyBehaviour
TabMoves to the actions, then the close button
Enter / SpaceActivates the focused action or close button

Screen readers

Errors use role="alert" and are announced at once; other statuses use role="status" and are announced politely. Only content that changes after the page loads is announced. A hidden status word ("Warning:") comes before the title; the icon is hidden.

Focus

The alert itself never takes focus. The close button has a 2px primary ring. After dismissing, move focus with onDismiss.

Contrast and colour

Every text pair is 4.5:1 or more and every icon 3:1 or more in all 60 combinations (see Colours and contrast). Status isn't shown by colour alone: the icon shape and the hidden status word carry it too. In forced-colours mode the container gets a system border.

Touch and pointer

The close button is a 24 × 24 target (WCAG 2.5.8). Actions are 24 tall in large alerts; in the one-line sizes they follow the line height and are spaced from the close button.

You must: write a title or description that makes sense alone, and move focus when a dismissed alert held it.

Figma mapping

Figma layerFigma valueCode
Reference rowsError, success, warning, gray, bluestatus: error, success, warning, neutral, information
Reference columnsSolid, tint, pale tint, white with borderappearance: filled, light, lighter, stroke
Reference blocksSmall one line, larger one line, with descriptionsize: xsmall, small, large
"Button · Learn More"Text actions with a dotactions with AlertAction
Figma 3806:36330Bg/Weak-50, information-fill, Label/Small · Paragraph/Smallneutral + lighter + large

Guidelines and related components

Use Alert for

  • Help or a status that belongs to one part of the page
  • Errors that stop a form or a sync
  • Warnings about limits, like a trial ending

Don't use Alert for

  • Short confirmations after an action (use Toast)
  • Decisions that must be made now (use Modal)
  • Field errors (use the Field error text)

Do and don't

Error: We couldn’t sync your notes

Check your connection. Changes are kept on this device.
DoSay what happened and what to do People know the problem and the next step.

Error: Error

Don'tUse a vague title with no next step “Error” alone doesn’t help anyone recover.

Success: Course completed

DoMatch the status to the meaning Success for done, warning for a risk.

Error: New feature: AI Tutor

Don'tUse error colours to draw attention A red alert for good news confuses people and screen readers announce it urgently.

Warning: Your trial ends in 3 days

Upgrade to keep your spaces.
DoKeep to one or two actions A clear next step, with a quiet secondary link.

Warning: Your trial ends in 3 days

Upgrade to keep your spaces.
Don'tStack full buttons inside the alert Heavy buttons compete with the page's main action.