CraftUI

Confirmation Dialog

A dialog that asks before doing something, with an optional box to tick before confirming.

Riverside is still here.

Open on a page of its own

Installation

npx shadcn@latest add @runqora/craft-confirmation-dialog

Usage

import { ConfirmationDialog } from "@/components/craft/blocks/confirmation-dialog";

<ConfirmationDialog
  acknowledgement="I understand this can't be undone"
  confirmLabel="Delete world"
  description="Riverside will be deleted from this device."
  destructive
  onConfirm={() => deleteWorld("riverside")}
  title='Delete "Riverside"?'
  trigger={<Button variant="destructive">Delete</Button>}
/>;

Props

ConfirmationDialog

Prop

Type

Accessibility

  • It's an alert dialog, named by its title and described by its text. Focus moves into it, and Escape closes it.
  • With acknowledgement, confirm stays disabled until the box is ticked, and the box is unticked again each time it opens.

Customization

Laid out as Ore UI's modal: the question in the title bar, the actions stacked at the bottom, confirm first. Pass open and onOpenChange to open it from your own code instead of a trigger.

Dependencies

  • craft-button, craft-checkbox, craft-dialog and craft-panel
  • shadcn's utils, and craft-theme

Source