Viora LogoViora UI
Login

Confirm Morph

An inline question button that morphs in-place for destructive or confirmation flows with undo and countdown timeout.

confirm-morph.tsx
Loading source code...

Installation

npx viora-ui@latest add confirm-morph
pnpm dlx viora-ui@latest add confirm-morph
npx viora-ui@latest add confirm-morph
bunx viora-ui@latest add confirm-morph

Step 1: Install Dependencies

npm install motion lucide-react

Step 2: Copy the Source Code Copy confirm-morph.tsx into your @/components/arc/confirm-morph/ directory.

Usage

import { Trash2 } from "lucide-react";
import { ConfirmMorph } from "@/components/arc/confirm-morph/confirm-morph";

export function DeleteSelection({ ids }: { ids: string[] }) {
  return (
    <ConfirmMorph
      label="Delete"
      icon={<Trash2 size={16} strokeWidth={1.75} />}
      prompt={`Delete ${ids.length} files?`}
      onConfirm={() => deleteFiles(ids)}
      onUndo={() => restoreFiles(ids)}
    />
  );
}

Props

PropTypeDefaultDescription
labelReactNode—The resting label content.
iconReactNode—Icon displayed before label.
promptReactNode—Inline question shown when confirming.
confirmLabelstring"Delete"Action confirm button text.
cancelLabelstring"Cancel"Action cancel button text.
pendingLabelstring"Deleting"Text shown during async execution.
doneLabelstring"Deleted"Result text upon completion.
undoLabelstring"Undo"Undo button label.
tone"danger" | "neutral""danger"Visual tone (danger/neutral).
onConfirm() => void | Promise<unknown>—Handler called when confirmed.
onUndo() => void | Promise<unknown>—Handler called when undone.
confirmTimeoutnumber6000Auto-dismiss timeout in ms.
resultTimeoutnumber5000Result display timeout in ms.

Built by Otis

Last updated: 10/12/2026