Alert

Alerts are the messengers of your application. They deliver important information, warnings, or confirmations with style and clarity.

Preview
Code

Basic Variants

Different Sizes

Dismissible Alerts

Auto-hide Alerts

With Custom Icons

Complex Alerts

Installation

First, make sure you have the required dependencies:

npx @rajdevxd/aura-ui add alert
yarn @rajdevxd/aura-ui add alert
pnpm dlx @rajdevxd/aura-ui add alert
bunx --bun @rajdevxd/aura-ui add alert

Usage

Here's how to create informative alerts:

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

const MyComponent = () => {
  return (
    <Alert variant="destructive">
      <AlertTitle>Error</AlertTitle>
      <AlertDescription>
        Something went wrong. Please try again.
      </AlertDescription>
    </Alert>
  )
}

Props

Alert

PropTypeRequiredDescription
variant"default" | "destructive"NoThe visual style variant of the alert
classNamestringNoAdditional CSS classes for custom styling

AlertTitle

PropTypeRequiredDescription
classNamestringNoAdditional CSS classes

AlertDescription

PropTypeRequiredDescription
classNamestringNoAdditional CSS classes

Features

  • Two Variants: Default and destructive for different message types
  • Icon Support: Easy to add icons for visual context
  • Structured Content: Separate title and description areas
  • Accessible: Proper ARIA roles and semantic markup

Common Issues

  1. "Alert not showing!" - Make sure you're providing content inside the Alert component
  2. "Colors not matching theme!" - Check your destructive color definitions
  3. "Icons not aligning!" - The component automatically handles icon positioning

Contributing

Alerts are crucial for user communication! Help us improve their styling and accessibility.

Alerts - because users deserve to know what's happening! 🚨