bearnie

Alert

Contextual messages for user feedback.

Installation

npx bearnie add alert
npx bearnie add alert

Usage

import {
  Alert,
  AlertTitle,
  AlertDescription,
} from "@/components/bearnie/alert"
<Alert>
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    You can add components to your app using the CLI.
  </AlertDescription>
</Alert>

Examples

Destructive

Success

Warning

Info

With Action

Add buttons to alerts for user actions like retry, dismiss, or learn more.

With Close Button

Add a close button to make alerts dismissible.

Include inline links within alert descriptions.

Title Only

Compact alert with just a title, no description.

Description Only

Alert with only a description, no title.

With List

Alert containing a list of items for multiple messages or requirements.

Anatomy

  • Alert - The root container with variant styling
  • AlertTitle - The heading text
  • AlertDescription - The descriptive content

Props

Alert

PropTypeDefaultDescription
variantdefault | destructive | success | warning | infodefaultVisual style variant
classstring-Additional CSS classes

AlertTitle

PropTypeDefaultDescription
classstring-Additional CSS classes

AlertDescription

PropTypeDefaultDescription
classstring-Additional CSS classes

Dependencies

The “With Action” and “With Close Button” examples use the Button component. Install it if you want to use those patterns.