Skip to content
nexubDesign System
v12.7.0

Components · Feedback

Alert

StableAdded v0.0.1

Inline contextual message with optional title, icon, and dismiss action.

import { Alert } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Communicating system status, errors, or success after an action

  • Showing inline validation feedback inside a form

  • Warning the user about a potentially risky operation

  • Providing contextual information relevant to the current page

Use something else for
  • Transient messages — use Toast for ephemeral notifications

  • Blocking the user for a required decision — use AlertDialog

  • Marketing or promotional messaging

  • Replacing empty states — use EmptyState instead

Playground

Props

TSX
<Alert title="Heads up" tone="info">Your trial expires in 3 days.</Alert>

Examples

Default

Tones

Dismissible

States

  • default
  • tone="neutral"
  • tone="info"
  • tone="success"
  • tone="warning"
  • tone="danger"
  • tone="leap"
  • tone="bookub"
  • tone="payub"

Props

Props
PropTypeDefaultDescription
tone'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'leap' | 'bookub' | 'payub' | 'founderub''neutral'Semantic colour tone of the alert.
titleReact.ReactNode—Bold title rendered at the top of the alert. 11.5: any content (a link, a name in bold); was a string.
iconReact.ReactNode—Custom icon rendered to the left of the content.
actionReact.ReactNode—Action element (e.g. a button) rendered beside the content.
onClose(() => void)—When provided, renders a close button that calls this handler.

Design tokens

Alert reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Alert below it, and leave the roles other components share alone. See the three token tiers.

Colours follow the variant, so only the radius is a token.

Alert design tokens
TokenAliasesNotes
--alert-radius--shape-container—
CSS
/* One area of your app */
.checkout {
  --alert-radius: var(--shape-field);
}