For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
0
Sponsor

Alert

Displays a callout for user attention.

import { CheckCircle2Icon } from "lucide-react";

import {
  Alert,
  AlertDescription,
  AlertTitle,

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.vercel.app/r/alert.json

Usage

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

Composition

Use the following composition to build an Alert:

Alert
├── AlertTitle
└── AlertDescription

Examples

Destructive

Use the destructive variant to indicate an error or a destructive action.

import { AlertCircleIcon } from "lucide-react";

import {
  Alert,
  AlertDescription,
  AlertTitle,

Action

Add an action to the AlertDescription to let the user respond.

import { RocketIcon } from "lucide-react";

import {
  Alert,
  AlertDescription,
  AlertTitle,

RTL

To enable right-to-left support, see the RTL guide.

"use client";

import { CheckCircle2Icon, InfoIcon } from "lucide-react";
import * as React from "react";

import { useTranslation } from "@/components/language-selector";

API Reference

Alert

The Alert component displays a callout for user attention.

PropTypeDefault
variant"default" | "destructive""default"

AlertTitle

The AlertTitle component displays the title of the alert.

PropTypeDefault
classNamestring-

AlertDescription

The AlertDescription component displays the description or content of the alert.

PropTypeDefault
classNamestring-