Skip to Content
Dither

Dither / components

Alert

A message that needs attention, with an optional action.

  • Stable
  • 5 variants
  • 1 props
  • Light & Dark
light
dark
Code
import { Alert02Icon, CheckmarkCircle02Icon, InformationCircleIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/lib/icon";import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";export default function AlertDemo() {  return (    <div className="grid w-full max-w-md gap-3">      <Alert>        <Icon icon={InformationCircleIcon} />        <AlertTitle>New report template</AlertTitle>        <AlertDescription>Quarterly revenue reports now include margin by team.</AlertDescription>      </Alert>      <Alert variant="positive">        <Icon icon={CheckmarkCircle02Icon} />        <AlertTitle>Invoice INV-2048 paid</AlertTitle>      </Alert>      <Alert variant="destructive">        <Icon icon={Alert02Icon} />        <AlertTitle>Payment failed</AlertTitle>        <AlertDescription>Your card was declined. Update your billing details to keep Atlas running.</AlertDescription>      </Alert>    </div>  );}

Installation

npx shadcn add @dither/alert

Usage

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";

<Alert variant="destructive">
  <Icon icon={Alert02Icon} />
  <AlertTitle>Payment failed</AlertTitle>
  <AlertDescription>Update your billing details.</AlertDescription>
</Alert>

AlertTitle, AlertDescription, AlertAction.

Props

Prop

Type

Examples

With an action

light
dark
Code
import { Notification01Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/lib/icon";import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/ui/alert";import { Button } from "@/components/ui/button";export default function AlertActionDemo() {  return (    <Alert variant="brand" className="max-w-md">      <Icon icon={Notification01Icon} />      <AlertTitle>Usage at 90%</AlertTitle>      <AlertDescription>2.2M of 2.4M API calls used.</AlertDescription>      <AlertAction>        <Button size="xs" variant="outline">Upgrade</Button>      </AlertAction>    </Alert>  );}
Dither · Alertv0.2.0

On this page