Alert

PreviousNext

Displays a callout for user attention.

alert-default

alert-error

alert-info

alert-success

alert-warning

alert-size

alert-01

alert-02

Installation

pnpm dlx shadcn@latest add alert

Usage

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

API Reference

Alert

PropTypeDefaultDescription
variant"default" | "destructive" | "success" | "warning" | "info""default"Controls the color scheme and intent of the alert.
size"sm" | "md" | "lg""md"Adjusts padding, text size, and icon sizing.
classNamestringAdditional CSS classes to style the alert.
...propsReact.ComponentProps<"div">All native div element props.

AlertTitle

PropTypeDefaultDescription
classNamestringAdditional CSS classes for the title.
...propsReact.ComponentProps<"div">All native div element props.

AlertDescription

PropTypeDefaultDescription
classNamestringAdditional CSS classes for the description.
...propsReact.ComponentProps<"div">All native div element props.