Alert

Alerts communicate persistent inline feedback with a clear semantic tone, concise text, and accessible announcement options when content changes dynamically.

Overview and decision boundary

Use Alert for inline feedback that should stay in the page flow and remain visible until the content changes.

Do not use Alert as a toast replacement or add dismiss behavior in this slice.

Update available
A new version of the application is available. Refresh to get the latest features and fixes.
import { Info } from "@nerio-ui/adapters/icons";import { Alert } from "@nerio-ui/ui";import { Button } from "@nerio-ui/ui/client";<Alert  tone="info"  icon={Info}  title="Update available"  action={<Button size="sm">Refresh</Button>}>  A new version of the application is available. Refresh to get the latest features and fixes.</Alert>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add alertimport { Circle } from '@nerio-ui/adapters/icons';import { Alert } from '@nerio-ui/ui';

Usage

import { Circle } from '@nerio-ui/adapters/icons';import { Alert } from '@nerio-ui/ui';<Alert tone="info" title="Invite sent" icon={Circle}>Collaborators will receive an email shortly.</Alert>

Variants

ToneUse
neutralLow-emphasis status or message that does not need a semantic emphasis.
infoInformational context that should remain calm and visible in the page flow.
successPositive completion or validation feedback.
warningAn issue that needs attention without blocking the entire flow.
dangerAn error, destructive outcome, or blocking state.

Anatomy

SlotPurpose
rootInline feedback region that applies tone and spacing tokens.
iconOptional decorative icon rendered through the Nerio icon adapter.
contentContainer for the title and descriptive content.
titleOptional short summary that establishes the message hierarchy.
descriptionBody content that explains the state or provides a next step.

States

StateBehavior
StaticNo live-region semantics are applied by default.
Status updateUse role="status" for a dynamic, non-urgent update.
Urgent updateUse role="alert" only when a dynamic error needs immediate announcement.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Static inline alerts do not announce by default; pass role="status" or role="alert" only for dynamic updates that need announcement.
  • Tone is supported by text; do not rely on color alone.
  • Optional icons must pass through the Nerio icon adapter.

API

PropValuesPurpose
toneneutral | info | success | warning | dangerSelects the semantic feedback treatment.
titleReactNodeAdds a concise summary above the description.
iconIconComponentRenders a decorative icon through the Nerio icon adapter.
actionReactNodeAdds one trailing action for a focused recovery or update.
rolestatus | alertOpt into announcement semantics only for dynamic content.
childrenReactNodeProvides the descriptive message content.
classNamestringExtends the root without replacing component tokens.

Implementation contract

ContractValue
Registry itemalert installs five source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Alert is a flat muted surface: semantic color stays on the icon while title and description remain neutral.
  • Use the message text and optional icon together so status never depends on color alone.

Do / do not

Do

Use Alert for inline validation summaries, persistent notices, and contextual feedback.

Do not

Use Alert as a toast replacement or add dismiss behavior to this static feedback pattern.

Tokens

GroupTokensControls
Layout--n-alert-gap / --n-alert-padding / --n-alert-radiusControls compact spacing and shape.
Surface--n-alert-border-width / --n-alert-border / --n-alert-background / --n-alert-shadowKeeps persistent feedback flat, muted, and borderless by default.
Emphasis--n-alert-title-color / --n-alert-icon-colorKeeps the title neutral and applies semantic emphasis only to the icon.
Icon--n-alert-icon-sizeControls the optional icon scale.
Semantic tones--n-color-status-info / success / warning / dangerControls semantic icon emphasis without changing the neutral text hierarchy.