Skip to documentation

Design system / Molecules

Molecule / Disclosure

AlertDialog

AlertDialog presents a decision with a title, consequence description and separate cancel/action controls. The caller selects the target and owns permission checks, pending behavior and operation results.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

No local decision yet.

Responsibility

The title, consequence description and action/cancel controls form one decision prompt. The manager owns target selection and operation results. Confirmation does not establish permission or automatically await an asynchronous action.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
open / defaultOpen / onOpenChangeRadix Root propsOptionalDisclosure binding; no request lifecycle.
size"default" | "sm"Content · default defaultLocal content-size treatment.
containerElement | DocumentFragment | nullContent · optionalPortal host for both overlay and content. Supply the owning theme scope when needed; omission retains Radix's body default. MemberManager supplies the same scope to its Sheet and nested confirmation.
variant / sizeButton propsAction / CancelAction defaults to default; Cancel defaults to outline. Neither is automatically destructive.
onClick / disabledPrimitive action propsConsumer-suppliedExecute intents and coordinate pending behavior outside the primitive.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

Radix controls dialog mechanics; the consumer owns decision target, permission, operation and outcome. MemberManager binds removeConfirm and onCancelRemove/onConfirmRemove. Action does not automatically await a request or guarantee the dialog remains open while saving.

Dependencies

  • Radix AlertDialog primitives and portal
  • Button through asChild for Action and Cancel
  • Optional Media, Header and Footer
  • cn()

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

bg-background / bg-black/50
Content and overlay utilities.
text-muted-foreground / bg-muted
Description and optional media surface.
Button variants / sizes
Action and cancellation inherit shared Button styling.

Boundaries and limitations

  • Important confirmation is not a substitute for server authorization.
  • No generic promise handling, rollback or failure presentation is added here.
  • Source has no automatic corner-close control; keep cancellation explicit.

Where to make a change

Change confirmation layout in alert-dialog.tsx; change affected-target descriptions and removal policy in the manager/adapter; change operation handling in the owning hook/service. Preserve safe focus and return behavior.

Selected real uses

MemberManager

Supplies removal consequences, including affected editions, and binds confirm/cancel callbacks. Destructive action styling is added by this consumer.

src/components/members/memberManager.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

import { AlertDialog, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from "@/components/ui/alert-dialog";

<AlertDialog open={confirming} onOpenChange={setConfirming}>
  <AlertDialogContent><AlertDialogTitle>Reset draft?</AlertDialogTitle>
    <AlertDialogDescription>Explain the consequence here.</AlertDialogDescription>
    <AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction onClick={resetDraft}>Reset</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.