An inline question button that morphs in-place for destructive or confirmation flows with undo and countdown timeout.
Installation
Usage
import { Trash2 } from "lucide-react";
import { ConfirmMorph } from "@/components/arc/confirm-morph/confirm-morph";
export function DeleteSelection({ ids = ["file-1", "file-2", "file-3"] }: { ids?: string[] }) {
const deleteFiles = async (fileIds: string[]) => {
await new Promise((r) => setTimeout(r, 1200));
console.log("Deleted files", fileIds);
};
const restoreFiles = async (fileIds: string[]) => {
await new Promise((r) => setTimeout(r, 800));
console.log("Restored files", fileIds);
};
return (
<ConfirmMorph
label="Delete"
icon={<Trash2 size={16} strokeWidth={1.75} />}
prompt={`Delete ${ids.length} files?`}
onConfirm={() => deleteFiles(ids)}
onUndo={() => restoreFiles(ids)}
/>
);
}API Reference
ConfirmMorph
| Prop | Type | Default | Description |
|---|---|---|---|
| label | ReactNode | — | The resting label content. |
| prompt | ReactNode | — | Inline question shown when confirming. |
| confirmLabel | string | "Delete" | Action confirm button text. |
| cancelLabel | string | "Cancel" | Action cancel button text. |
| onConfirm | () => void | Promise<unknown> | — | Handler called when confirmed. |
| onUndo | () => void | Promise<unknown> | — | Handler called when undone. |
Built by Otis
Last updated: 10/12/2026