Components

Alert

The shadcn/ui Alert with tinted success, warning and info variants for dark UIs and a slot for actions — plus two animated React alert blocks built with Motion: a dismissible alert that collapses smoothly and can auto-dismiss with a progress line, and an announcement banner that slides in from the top of the page.

  • Drop-in shadcn API
  • Status variants
  • Motion blocks
  • prefers-reduced-motion
New: branch previews
Every pull request now gets its own URL. Share it with reviewers in one click.
Settings saved
Closes by itself in 5 seconds. Hover or focus it to pause.

Content below slides up as the alerts close.

Installation

$ npx shadcn@latest add https://duskui.com/r/alert.json

Same exports as shadcn/ui (Alert, AlertTitle, AlertDescription) plus AlertAction and the success, warning and info variants. CSS only, so it works in Server Components.

Usage

build-warning.tsx
import { TriangleAlert } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function BuildWarning() {
  return (
    <Alert variant="warning">
      <TriangleAlert />
      <AlertTitle>You're at 90% of your build minutes</AlertTitle>
      <AlertDescription>Builds pause when you hit the limit.</AlertDescription>
    </Alert>
  )
}

Examples

Default and destructive

The shadcn/ui default and destructive variants. Alerts use role="alert" like shadcn; pass role="status" for messages that shouldn't interrupt a screen reader.

Heads up!
You can add components to your app with the shadcn CLI.

Status variants

success, warning and info use translucent tints that read well on near-black surfaces. Links inside the description inherit the alert's color and are underlined.

Deployment complete
dusk-web is live on 3 regions in 42 seconds.
Scheduled maintenance on Sunday, 02:00 UTC

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Dismissible Alert

An Alert with a close button. On dismiss it fades out while its height collapses, so the content below slides up instead of jumping. Set autoDismiss (ms) and it closes itself, drawing a shrinking line along the bottom; the countdown pauses while the alert is hovered or focused and while the tab is hidden. Escape inside the alert dismisses it too.

New: branch previews
Every pull request now gets its own URL. Share it with reviewers in one click.
Settings saved
Closes by itself in 5 seconds. Hover or focus it to pause.

Content below slides up as the alerts close.

$ npx shadcn@latest add https://duskui.com/r/dismissible-alert.json
PropTypeDefaultDescription
variant"default" | "destructive" | "success" | "warning" | "info""default"Alert variant. destructive and warning use role="alert", the rest role="status".
titleReactNode—Alert title.
childrenReactNode—The description.
iconReactNode | null—Leading icon. Defaults to one per variant; null hides it.
actionsReactNode—Buttons under the description.
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void— / true / —Controlled or uncontrolled visibility.
onExitComplete() => void—Runs once the exit animation has finished.
autoDismissnumber—Close after this many ms, with a progress line.
dismissiblebooleantrueShow the close button and allow Escape.
dismissLabelstring"Dismiss"Accessible label of the close button.

A full-width announcement bar for the top of a page. It slides down from above while its height grows, so the page eases down rather than jumping. Pass storageKey to remember the dismissal in localStorage; the stored value is read after hydration with useSyncExternalStore, so server and client HTML always match. For zero layout shift, render it inside a fixed or sticky header.

Usage-based billing starts June 1. Review your plan before then.See what changes

Acme
$ npx shadcn@latest add https://duskui.com/r/banner-alert.json
PropTypeDefaultDescription
childrenReactNode—The announcement text.
variant"default" | "info" | "success" | "warning" | "destructive""default"Color scheme. default is a neutral card surface.
actionReactNode—A call to action after the text, e.g. a link.
iconReactNode | null—Leading icon. Defaults to one per variant; null hides it.
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void— / true / —Controlled or uncontrolled visibility.
storageKeystring—Remember the dismissal under this localStorage key. Change it for a new announcement.
animateOnMountbooleantrueSlide in after mount instead of rendering open.
delaynumber0.2Seconds before sliding in.
dismissiblebooleantrueShow the close button.
labelstring"Announcement"Accessible name of the region.

API Reference

Same parts as shadcn/ui: Alert, AlertTitle and AlertDescription, plus AlertAction. Each forwards the props of a div.

PropTypeDefaultDescription
variant"default" | "destructive" | "success" | "warning" | "info""default"Color scheme (on Alert).
rolestring"alert"Override with "status" for non-urgent messages (on Alert).
AlertActiondiv props—Top-right slot for a close button or menu; the text makes room for it.
alertVariantscva—The variant classes, exported for custom elements.

Accessibility

  • Alerts render role="alert", which interrupts screen readers. Use role="status" for confirmations and tips; Dismissible Alert picks the right one per variant.
  • Put a leading icon inside the Alert; it is decorative, so the title must carry the meaning (don't rely on color alone).
  • The Dismissible Alert close button is a real button with an accessible label, and Escape anywhere inside the alert dismisses it. Its auto-dismiss pauses on focus, so keyboard users get time to read and act.
  • The Banner Alert is a labelled region, not an alert, so it never interrupts; its close button has an accessible label.
  • Under prefers-reduced-motion the blocks skip scale and slide, and only fade and collapse.