AccordionAlert Dialog
Get Started
Introduction
Components
Accordion
Badge
Button
Card
Checkbox
Command
Dialog
Dropdown Menu
Input
Select
Switch
Table
Tabs
Toast
Tooltip
Forms
Controlled Input
Field Arrays
Submit
Validation

Displays a callout for important content.

default
destructive

#Installation

bunx --bun barefoot add alert

#Usage

1import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert'23function AlertDemo() {4  return (5    <Alert>6      <TerminalIcon />7      <AlertTitle>Heads up!</AlertTitle>8      <AlertDescription>9        You can add components to your app using the CLI.10      </AlertDescription>11    </Alert>12  )13}

#Examples

#Default

<Alert>
  <TerminalIcon />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    You can add components to your app using the CLI.
  </AlertDescription>
</Alert>

#Destructive

<Alert variant="destructive">
  <CircleAlertIcon />
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>
    Your session has expired. Please log in again.
  </AlertDescription>
</Alert>

#API Reference

Alert

PropTypeDefaultDescription
variant'default' | 'destructive''default'The visual style of the alert.
childrenChild-The content of the alert (typically an SVG icon, AlertTitle, and AlertDescription).

AlertTitle

PropTypeDefaultDescription
childrenChild-The title text of the alert.

AlertDescription

PropTypeDefaultDescription
childrenChild-The description text of the alert.