Skip to content
Hazine

Consequence List Alert Dialog

Confirmation that lists every effect with its count, split into what is lost and what is kept, and holds the confirm button until an acknowledgement is ticked. Use it before deleting an account, workspace or dataset.

How it differs. The body is a framed list of counted effects in a lost group and a quieter kept band, and the confirm button stays gated behind one acknowledgement checkbox that it points to when pressed early.

Install

pnpm dlx shadcn@latest add @hazine/alert-dialog-consequence-list

Adds 1 file, 4 shadcn primitives (alert-dialog, button, checkbox, label), 1 Hazine item (@hazine/use-controllable-state), and 1 package (lucide-react).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props15

trigger
React.ReactNode
A single button element that opens the dialog. Focus returns to it on close.
title
string = "Delete this workspace?"
description
string = "Deleting takes effect at once for every member and cannot be reversed."
One sentence under the title. It is the text read out when the dialog opens.
groups
ConsequenceGroup[] = DEFAULT_GROUPS
Effects in reading order. A group with no items is not rendered.
acknowledgementLabel
string = "I understand that this cannot be undone."
The statement beside the checkbox. Name what is lost, with its numbers.
acknowledged
boolean
defaultAcknowledged
boolean = false
onAcknowledgedChange
(acknowledged: boolean) => void
confirmLabel
string = "Delete workspace"
cancelLabel
string = "Keep workspace"
onConfirm
() => void
Called on confirm with the box ticked. An uncontrolled dialog then closes. A controlled one stays open, so `loading` and `error` show in place.
loading
boolean = false
The action is running. Both buttons and Escape stop responding and keep focus.
loadingLabel
string = "Deleting"
Progressive verb that replaces the confirm label while loading.
error
string
Why the action failed and what to do next. Announced as an alert.
locale
string = "en-US"

Also accepts every prop of Omit< React.ComponentProps<typeof AlertDialogContent>, "title" | "children" > and Pick< React.ComponentProps<typeof AlertDialog>, "open" | "defaultOpen" | "onOpenChange" >.

Accessibility

Keyboard
Keyboard support for Consequence List Alert Dialog
KeyEffect
Tab, Shift+TabCycles through the acknowledgement, the cancel button and the confirm button. Focus stays inside the dialog and starts on cancel. While the action is running the acknowledgement is skipped
Space on the acknowledgementTicks or clears it, which opens or closes the confirm button
Enter or Space on confirmRuns the action when the box is ticked. Otherwise moves focus to the acknowledgement
Enter or Space on cancelCloses the dialog without running the action and returns focus to the trigger. Ignored while the action is running
EscapeCancels and returns focus to the trigger. Ignored while the action is running
Arrow Up, Arrow Down on the listScrolls the list. It is a tab stop only when it is taller than the dialog
Screen reader

Modal alertdialog named by its title and described by the one-sentence summary. Each group is a list labelled by its heading. The confirm button is aria-disabled, not disabled, and described by the acknowledgement until the box is ticked. A count shortened on screen is read out in full.

  • Announces: {loadingLabel}
  • Announces: {error}
Reduced motion
The loading spinner does not rotate. The dialog fade and scale come from the host alert-dialog primitive.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies6

  • alert-dialog
  • button
  • checkbox
  • label
  • @hazine/use-controllable-state
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.