Unified UI

Alert

A static notification component for contextual feedback messages with semantic variants, dismissible close, collapsible content, and optional animated entrance.

Basic

Contextual feedback messages for inline notifications, validation, system status, tips, and collapsible information blocks. Supports 5 semantic variants, dismissible close, collapsible mode, and animated entrance.

You can press Ctrl+S to save your work at any time.
Your order has been confirmed and is being processed.
This is a generic note without semantic meaning.

Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add alert
pnpm dlx @work-rjkashyap/unified-ui add alert
npx @work-rjkashyap/unified-ui add alert
bunx @work-rjkashyap/unified-ui add alert

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	Alert,
	Callout,
} from "@work-rjkashyap/unified-ui";

Basic Usage

<Alert variant="info" title="Did you know?">
  Unified UI components are fully tree-shakeable via layer-specific imports.
</Alert>

<Alert variant="danger" dismissible onDismiss={() => setVisible(false)}>
  Something went wrong. Please try again.
</Alert>

<Alert variant="info" title="FAQ" collapsible defaultOpen={false}>
  Expandable content goes here.
</Alert>

Variants

Alert supports five semantic variants that determine color, icon, and ARIA role.

Info (default)

Used for informational messages, tips, and notes. Renders with role="status" (polite live region).

You can drag and drop files to upload them.

Success

Used for positive outcomes like confirmations and completions. Renders with role="status".

Your profile has been updated successfully.

Warning

Used for caution messages and deprecation notices. Renders with role="alert" (assertive live region).

Danger

Used for error messages and destructive action warnings. Renders with role="alert".

Default

A neutral variant with no semantic color. Use for generic notes that don't fit info/success/warning/danger. Renders with role="status".

This callout uses the neutral default variant for generic notes.
VariantBackgroundBorderIcon ColorARIA RoleUse Case
info--info-muted--info/20--info"status"Tips, guidance, neutral info
success--success-muted--success/20--success"status"Confirmations, completed actions
warning--warning-muted--warning/20--warning"alert"Cautions, deprecation notices
danger--danger-muted--danger/20--danger"alert"Errors, destructive action alerts
default--muted--border--muted-fg"status"Generic notes, neutral callouts

Without Title

Alerts can be rendered without a title for simpler, single-line messages.

This feature is currently in beta.

Dismissible

Add the dismissible prop to show a close button. Provide an onDismiss callback to control visibility externally, or let the alert manage its own visibility.

This alert will hide itself when dismissed.

Collapsible

Set collapsible to make the body expandable/collapsible. The chevron animates on toggle. Use defaultOpen to control initial state.

Animated

Set animated to enable a fade-in entrance animation. The animation respects prefers-reduced-motion.

Version 2.4.1 is live on production.
This animated alert fades in on mount.

Custom Icons

Override the default variant icon with the icon prop, or pass null to hide it entirely.

💡
You can pin your most-used commands to the sidebar for quick access.
🚀
Version 2.4.1 is live on production. Rollback is available for 24 hours.

In Context

A common pattern is to place alerts above or below forms to provide contextual guidance.

<form className="flex flex-col gap-4">
	<Alert variant="info" title="Changing your email">
		A verification link will be sent to your new address. Your current email
		remains active until the new one is confirmed.
	</Alert>

	<div className="flex flex-col gap-1.5">
		<label className="text-sm font-medium">New Email</label>
		<Input type="email" placeholder="you@example.com" />
	</div>

	<Button variant="primary">Update Email</Button>
</form>

Migrating from Callout

The Callout component has been merged into Alert. The Callout export is still available as a backward-compatible alias that defaults to animated={true} and rounded-lg.

// Before (Callout)
import { Callout } from "@work-rjkashyap/unified-ui";
<Callout variant="info" title="Did you know?" collapsible>
	Content here.
</Callout>;

// After (Alert) — equivalent
import { Alert } from "@work-rjkashyap/unified-ui";
<Alert
	variant="info"
	title="Did you know?"
	collapsible
	animated
	className="rounded-lg"
>
	Content here.
</Alert>;
Callout PropAlert Equivalent
variantvariant (now includes "default")
titletitle
iconicon
collapsiblecollapsible
defaultOpendefaultOpen
(always animated)animated={true}
(always rounded-lg)className="rounded-lg"

Props

PropTypeDefaultDescription
variant"info" | "success" | "warning" | "danger" | "default""info"Semantic variant determining color, icon, and ARIA role.
titleReactNode—Title text displayed prominently at the top.
iconReactNode | nullAuto (per variant)Custom icon. Pass null to hide.
dismissiblebooleanfalseWhether to show a close button. Cannot combine with collapsible.
onDismiss() => void—Callback when dismissed. If omitted, alert self-manages visibility.
dismissLabelstring"Dismiss alert"Accessible label for the dismiss button.
collapsiblebooleanfalseWhether the body can be toggled open/closed. Cannot combine with dismissible.
defaultOpenbooleantrueInitial open state when collapsible is true.
animatedbooleanfalseAnimate entrance with fadeIn Framer Motion preset.
role"alert" | "status"Auto (per variant)ARIA role. Danger/warning default to "alert", others "status".
classNamestring—Additional CSS classes merged on the root element.
childrenReactNode—Description / body content.

Motion

  • Animated entrance — fadeIn preset with opacity: 0 → 1 and subtle translate. Opt-in via animated prop.
  • Collapsible — expandHeight preset for smooth height transitions when toggling open/close.
  • Chevron rotation — Smooth 180° rotation on the collapsible toggle indicator.
  • All animations respect prefers-reduced-motion — disabled automatically when the user prefers reduced motion.

Accessibility

  • Danger and warning alerts use role="alert" (assertive live region) — screen readers announce them immediately.
  • Info, success, and default alerts use role="status" (polite live region) — announced at the next opportunity.
  • Each variant renders a unique icon so meaning is never conveyed by color alone (WCAG 1.4.1).
  • The dismiss button has a configurable aria-label (defaults to "Dismiss alert").
  • Collapsible header uses aria-expanded for screen readers and responds to Enter / Space.
  • Icons are decorative and marked with aria-hidden="true".
  • The chevron icon is aria-hidden="true".

Design Tokens

TokenUsage
--info-mutedInfo variant background
--success-mutedSuccess variant background
--warning-mutedWarning variant background
--danger-mutedDanger variant background
--mutedDefault variant background
--borderDefault variant border
--radius-mdBorder radius (rounded-md)
--radius-lgCallout alias radius
--duration-fastTransition speed

On this page