Primitives

Confirm dialog

center, split, banner, sheet; danger, warning, primary; type a word or press and hold for the irreversible ones. Focus starts on Cancel.

Import#

Everything comes from the package root. The example above uses:

your-component.tsx
import { Button, ConfirmDialog, type ConfirmTone, type ConfirmVariant, toast } from "@waveinno/ui";

Props#

Read from the source of this version, so they match the code exactly.

<ConfirmDialog>

src/components/ui/confirm-dialog.tsx
PropTypeDefaultDescription
openrequiredboolean—
onOpenChangerequired(open: boolean) => void—
titlerequiredReact.ReactNode—
descriptionReact.ReactNode—
itemsstring[]—What is affected: names shown in a list (first `previewCount`, then "+ n more").
previewCountnumber3
confirmWordstring—Require typing this word (e.g. "DELETE") before the button unlocks.
holdboolean | number—Press and hold the button to confirm; a number sets the hold in ms (default 1200).
confirmLabelrequiredReact.ReactNode—
cancelLabelReact.ReactNode"Cancel"
tone"danger" | "warning" | "primary""danger"
variant"center" | "split" | "banner" | "sheet""center"
iconReact.ReactNode—
onConfirmrequired() => void | Promise<void>—Runs on confirm; the button spins until it settles, the dialog closes on success.
labels{ typeToConfirm?: (word: string) => string; more?: (n: number) => string; hold?: string }—

<Button>

src/components/ui/button.tsx
PropTypeDefaultDescription
asChildbooleanfalse
loadingboolean—

Also takes ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>.

Install#

If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.

$ npm install @waveinno/ui