Display

Alert

A callout in the flow of the page: an icon, a title, a description and an optional action.

packages/design-system/components/ui/alert.tsx

Examples

Default
Destructive
With an action

Anatomy

  1. 01Box, role="alert", rounded-2xl
  2. 02Icon, spans both rows
  3. 03Title
  4. 04Description
  5. 05Action, top right

Usage

import { Alert, AlertAction, AlertDescription, AlertTitle } from "@repo/design-system/components/ui/alert";

<Alert variant="destructive">
  <CircleAlertIcon />
  <AlertTitle>Payment failed</AlertTitle>
  <AlertDescription>The card was declined.</AlertDescription>
</Alert>

Props

PropTypeDefaultDescription
variant"default" | "destructive""default"Destructive turns the text and icon red on the card background.
classNamestringnoneMerged last with cn(). Use it for layout (width, margin), not to restyle the component.

Guidance

Do

  • Say what happened and what to do next.

Don't

  • Use it for confirmations that should disappear. Use a toast.