GitHub 560+

Alert

Displays a callout for user attention.

Installation

npx shadcn@latest add @fulldev/alert

Usage

import {
  Alert,
  AlertAction,
  AlertDescription,
  AlertTitle,
} from "@/components/ui/alert"
<Alert variant="default">
  <Terminal />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    Install components through the CLI and keep the source in your project.
  </AlertDescription>
</Alert>

Example

Use AlertAction when the alert should include a secondary control such as a button.

Composition

Use the following composition to build an Alert:

Alert
├── Icon
├── AlertTitle
├── AlertDescription
└── AlertAction

Notes

  • Use Alert for inline feedback inside the page flow.
  • Use variant="destructive" for error or warning states that need stronger emphasis.
  • For destructive confirmation flows, use Alert Dialog instead.

API Reference

See the GitHub source code for more information on props.