Alert

Displays a callout for user attention.

Installation

Install this component via the shadcn CLI.

npx shadcn@latest add https://baby-baltazar-xi.vercel.app/r/alert.json

Or install the theme first: npx shadcn@latest add https://baby-baltazar-xi.vercel.app/r/sthlm-theme.json

Preview

Interactive component demo.

Default

Destructive

Without Icon

Title Only

Usage

How to use this component in your code.

{/* Default */}
<Alert>
  <Terminal className="h-4 w-4" />
  <AlertTitle>Title</AlertTitle>
  <AlertDescription>Description</AlertDescription>
</Alert>

{/* Destructive */}
<Alert variant="destructive">
  <AlertCircle className="h-4 w-4" />
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>Description</AlertDescription>
</Alert>

{/* Without icon */}
<Alert>
  <AlertTitle>Note</AlertTitle>
  <AlertDescription>Description</AlertDescription>
</Alert>