Skip to Content

Alert

Displays a callout for user attention.

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { InfoIcon } from "lucide-react"

export function Demo() {
  return (
    <Alert>
      <InfoIcon className="size-4" />
      <AlertTitle>Invoice INV-2041 sent</AlertTitle>
      <AlertDescription>Acme Corp was emailed a payment link for $4,200.00.</AlertDescription>
    </Alert>
  )
}

Installation

npm i @dapplelight/signet-ui

Usage

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"

<Alert>
  <AlertTitle>Heads up</AlertTitle>
  <AlertDescription>Something worth reading.</AlertDescription>
</Alert>

Examples

Destructive

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { CircleAlertIcon } from "lucide-react"

<Alert variant="destructive">
  <CircleAlertIcon className="size-4" />
  <AlertTitle>Payment failed</AlertTitle>
  <AlertDescription>The card ending 4242 was declined. Update it to keep your plan.</AlertDescription>
</Alert>

Warning

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { AlertTriangleIcon } from "lucide-react"

<Alert variant="warning">
  <AlertTriangleIcon className="size-4" />
  <AlertTitle>Usage at 92%</AlertTitle>
  <AlertDescription>You have used 9,200 of 10,000 API calls this month.</AlertDescription>
</Alert>

Without an icon

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"

<Alert>
  <AlertTitle>Scheduled maintenance</AlertTitle>
  <AlertDescription>Reports will be unavailable on Sunday from 02:00 to 03:00 UTC.</AlertDescription>
</Alert>

Composition

import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"

export function DeployAlerts() {
  return (
    <div className="grid gap-4">
      <Alert>
        <AlertTitle>Deploy succeeded</AlertTitle>
        <AlertDescription>production · 41s · commit 9f3c2e1</AlertDescription>
      </Alert>
      <Alert variant="destructive">
        <AlertTitle>Card declined</AlertTitle>
        <AlertDescription>Ask the customer for another payment method.</AlertDescription>
      </Alert>
    </div>
  )
}

API Reference

Alert

PropTypeDefaultRequiredDescription
variant"default" | "destructive" | "warning""default"NoColour of the border, background and icon.
classNamestring—NoMerged last.

Plus every native <div> attribute. Renders with role="alert". A direct child svg is placed at the start and the text indents past it.

AlertTitle

PropTypeDefaultRequiredDescription
classNamestring—NoMerged last.

Plus every native <h5> attribute.

AlertDescription

PropTypeDefaultRequiredDescription
classNamestring—NoMerged last.

Plus every native <div> attribute.