Data & feedback@neumorphism-ui/alert

Alert

A composable Alert that aligns an icon, title, and description. It provides default, success, and destructive variants, each combining color with border and text contrast.

@neumorphism-ui/alert
Registry JSON

Preview

Installation

Installation: alertnpx shadcn@latest add @neumorphism-ui/alert

The CLI resolves npm dependencies, base tokens, utilities, and component source in order.

New to this Registry? Set up the namespace before continuing.

Usage

Import

Alert import code
import {
  Alert,
  AlertDescription,
  AlertTitle,
} from "@/components/ui/alert"

Example

Alert usage code
<Alert variant="success">
  <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="m5 12 4 4L19 6" /></svg>
  <AlertTitle>Changes saved</AlertTitle>
  <AlertDescription>
    Your changes are now available to every team member.
  </AlertDescription>
</Alert>

API Reference

ComponentPropTypeDefaultDescription
Alertvariant"default" | "success" | "destructive""default"Selects the semantic meaning and visual treatment of the message.
AlertchildrenReact.ReactNode—Arranges the icon, AlertTitle, and AlertDescription.
AlertclassNamestring—Extends the default surface styles.

Accessibility

  • 01

    Alert uses role=alert and is appropriate for important messages that appear dynamically.

  • 02

    Static guidance that is present on page load may not need the immediate announcement from role=alert; override the role or use another container when appropriate.

  • 03

    Mark decorative icons with aria-hidden=true and communicate the same meaning in the title and description.