Alert

A callout for displaying important information.

Installation

npx love-ui@latest add alert

Usage

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

Examples

With Icon

With Icon and Action Buttons

Info Alert

Success Alert

Warning Alert

Error Alert

Comparing with shadcn

New Variants

We've added new colored variants for better semantic meaning:

VariantDescription
infoDisplays an info alert (blue)
successDisplays a success alert (green)
warningDisplays a warning alert (yellow)
errorDisplays a error alert (red)

Ensure you have the following variables imported in your CSS file:

  • --destructive-foreground
  • --info
  • --info-foreground
  • --success
  • --success-foreground
  • --warning
  • --warning-foreground