Alert essentials

alert-styled is a set of five decorative alert components (SoftAlert, LeftBarAlert, GlassAlert, GlowAlert, IconPulseAlert) built on the ai2 semantic token system. Each renders role="alert" with an optional leading icon, title, and description, and supports sm to xl sizes and info, success, warning, or danger tones.

componentstyledalertregistry-item.json
Alert essentials
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/alert-styled

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { SoftAlert, LeftBarAlert, GlassAlert, GlowAlert, IconPulseAlert } from "@/components/ui/alert-styled"export function Demo() {  return (    <SoftAlert tone="success" size="md" title="Saved">      Your changes are live.    </SoftAlert>  )}
  • Use a highlighted, decorative inline message (success, warning, info, or error) that needs more visual personality than a plain alert.
  • Use LeftBarAlert for dense dashboards or settings pages where a strong edge accent signals status without a heavy fill.
  • Use GlassAlert or GlowAlert for hero sections, promotional banners, or landing pages that need a frosted or glowing emphasis.
  • Use IconPulseAlert when a status icon should draw attention without becoming distracting, for example an unread or pending notice.

Examples

SoftAlert with an icon

Default soft-filled info alert with a leading icon, title, and description.

softalert-with-an-icon.tsx
import { Info } from "lucide-react"import { SoftAlert } from "@/components/ui/alert-styled"export function InfoNotice() {  return (    <SoftAlert      tone="info"      size="md"      title="Maintenance window"      icon={<Info />}    >      The service will be briefly unavailable on Sunday at 02:00 UTC.    </SoftAlert>  )}

LeftBarAlert for a danger state

Neutral surface with a bold danger-coloured left edge, suited to dense forms.

leftbaralert-for-a-danger-state.tsx
import { AlertTriangle } from "lucide-react"import { LeftBarAlert } from "@/components/ui/alert-styled"export function PaymentError() {  return (    <LeftBarAlert      tone="danger"      size="sm"      title="Payment failed"      icon={<AlertTriangle />}    >      Check your card details and try again.    </LeftBarAlert>  )}

GlassAlert promotional banner

Frosted warning banner for a hero or promotional area, sized xl.

glassalert-promotional-banner.tsx
import { AlertTriangle } from "lucide-react"import { GlassAlert } from "@/components/ui/alert-styled"export function TrialBanner() {  return (    <GlassAlert      tone="warning"      size="xl"      title="Trial ends in 2 days"      icon={<AlertTriangle />}    >      Upgrade now to keep your projects.    </GlassAlert>  )}

IconPulseAlert for a pending notice

Soft success alert whose icon pulses to draw attention; the pulse respects reduced motion.

iconpulsealert-for-a-pending-notice.tsx
import { CheckCircle2 } from "lucide-react"import { IconPulseAlert } from "@/components/ui/alert-styled"export function SyncStatus() {  return (    <IconPulseAlert      tone="success"      size="md"      title="Syncing"      icon={<CheckCircle2 />}    >      Your library is being updated.    </IconPulseAlert>  )}

API reference

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"Padding and text size preset: sm uses p-3 text-sm, md uses p-4 text-sm, lg uses p-4 text-base, xl uses p-5 text-base. Applies to all five variants.
tone"info" | "success" | "warning" | "danger""info"Semantic colour tone mapped to the info, success, warning, and danger tokens. Also sets the icon colour and the data-tone attribute.
titleReact.ReactNodenullOptional title rendered in a medium-weight row above the description. Not rendered when falsy.
iconReact.ReactNodenullOptional leading icon node, wrapped in a shrink-0 span. In IconPulseAlert this span is animated.
childrenReact.ReactNodenullDescription content, rendered in a slightly dimmed text block below the title. Not rendered when falsy.
classNamestringnullAdditional class names merged onto the root div with cn(). Overrides the base styles when conflicting.
...propsReact.ComponentProps<"div">nullAll other standard div attributes (id, style, data-*, event handlers, etc.) are forwarded to the root element. Note that role="alert" is set before the spread, so a passed role will override it.

Accessibility

  • Each root element has role="alert", so screen readers announce the message when it appears. Render it only when the message is relevant, or the announcement may be noisy.
  • The title is a plain div, not a heading element. If the title needs to be navigable, pass a heading element as the title node, for example <h3>.
  • Icons are not hidden from assistive technology by the component. Pass aria-hidden="true" on decorative icons such as lucide icons so they are not read aloud.
  • IconPulseAlert stops its icon animation when the user prefers reduced motion (useReducedMotion), so no animation plays in that case.
  • Tone is conveyed through colour. Include the status in the title or description text so the meaning does not depend on colour alone.
  • GlassAlert uses reduced background opacity and backdrop blur only where supports-[backdrop-filter] applies. Verify text contrast against the background behind it.
  • Keep the description readable: it uses opacity-90, so confirm the resulting contrast meets WCAG AA in each tone.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Alert essentials" component (ai2/alert-styled) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/alert-styled2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, tone, title, icon, children, className, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { SoftAlert, LeftBarAlert, GlassAlert, GlowAlert, IconPulseAlert } from "@/components/ui/alert-styled"export function Demo() {  return (    <SoftAlert tone="success" size="md" title="Saved">      Your changes are live.    </SoftAlert>  )}```

Files & dependencies

  • registry/ai2/styled/alert-styled.tsx→ components/ui/alert-styled.tsx
dependenciesmotion@^12.42.2
registryDependencies@ai2/tokens

Looks similar, elsewhere