sc1m/design
ComponentsAlert Dialog

Alert Dialog

Alert Dialog component built on Base UI, styled with sc1m tokens.

StableBase UI

Live preview

Installation

pnpm dlx shadcn@latest add @sc1m/alert-dialog

This also merges the token layer and installs src/lib/cn.ts plus @base-ui/react. For the manual route — prerequisites, components.json, and app-level setup — see Installation.

Usage

import {
  AlertDialog,
  AlertDialogTrigger,
  AlertDialogContent,
  AlertDialogTitle,
  AlertDialogDescription,
  AlertDialogClose,
} from "@/components/ui/alert-dialog";

Composition

Every part is a separate export. AlertDialog owns state; the rest are presentational and must appear in this order.

AlertDialog├── AlertDialogTrigger└── AlertDialogContent    ├── AlertDialogTitle    ├── AlertDialogDescription    └── AlertDialogClose

Example

The preview above, with its source. This is the demo module verbatim, so the code and the thing it renders cannot drift apart.

<AlertDialog>
  <AlertDialogTrigger render={<Button variant="danger" />}>
    Delete workspace
  </AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogTitle className="text-base font-semibold">
      Delete workspace
    </AlertDialogTitle>
    <AlertDialogDescription className="mt-1 text-sm text-fg-muted">
      This action is permanent and cannot be undone.
    </AlertDialogDescription>
    <div className="mt-5 flex justify-end gap-2">
      <AlertDialogClose render={<Button variant="ghost" />}>
        Cancel
      </AlertDialogClose>
      <AlertDialogClose render={<Button variant="danger" />}>
        Delete
      </AlertDialogClose>
    </div>
  </AlertDialogContent>
</AlertDialog>

API reference

Each part forwards every prop of its Base UI counterpart; the tables list the ones declared on the part itself. See Base UI's reference for the inherited element props.

AlertDialog

PropTypeDefaultDescription
onOpenChange((open: boolean, eventDetails: AlertDialogRoot.ChangeEventDetails) => void)Event handler called when the alert dialog is opened or closed.
actionsRefReact.RefObject<AlertDialogRoot.Actions | null>A ref to imperative actions.
handleAlertDialogHandle<Payload>A handle to associate the alert dialog with a trigger.

AlertDialogTrigger

PropTypeDefaultDescription
handleAlertDialogHandle<Payload>A handle to associate the trigger with an alert dialog.

Accessibility

Behaviour, focus management, and ARIA wiring come from Base UI's Alert Dialog — see its reference for the full keyboard map.

Design tokens

The component reads semantic tokens only — no raw colour, radius, or duration appears in its source. Override the token, not the component.

TokenApplied to
--brand-radius-xlAlertDialogContent
--fgAlertDialogContent
--lineAlertDialogContent
--shadow-overlayAlertDialogContent
--surface-raisedAlertDialogContent

Source

src/components/ui/alert-dialog/alert-dialog.tsx — no next/* imports, so it drops into any React 19 + Tailwind v4 app.