Confirm morph

A React component in Beamline's Actions category.

A destructive action that asks in place: the button morphs into its question, then into working, then into the result with Undo or Retry, without a dialog.

Use it for

  • Destructive or costly actions in dense places (table rows, cards) where a dialog would be heavy.

Not for

Anatomy

  • trigger
  • question with Cancel and Confirm (the question truncates in a narrow room; it stays the group's name)
  • working status
  • result with Undo
  • error with Retry
  • timer (a line draining over the wait before the question backs out or a result rests)

Variants

  • tone: danger, neutral

States

  • idle
  • confirming (the wait drains; held while pointed at or focused)
  • pending
  • done (the wait drains; held while pointed at or focused)
  • error
  • undoing

Keyboard

  • Enter opens the question
  • focus starts on Cancel
  • Escape cancels
  • focus returns to the trigger

Motion

The frame resizes over --pui-duration-morph while each state cross-fades with a slight blur; reduced motion swaps instantly. While the question or a result waits to back out, a line along the bottom drains over the wait (autoCancelAfter, resultFor) and holds, with the timer, while the control is pointed at or holds focus.

Props

PropTypeDefaultDescription
label / icon / promptReactNode—label: The action at rest: "Delete project". icon: Icon element shown beside the label. Defaults to no leading icon. prompt: The question while asking: "Delete “Q3 pipeline”?"
labelsPartial<{ confirm, cancel, pending, done, error, retry, undo, undoing }>—Words for each step; give only the ones you change.
onConfirm / onUndo() => void | Promise<unknown>—onConfirm: Runs the action. Return a promise and the control shows working, then done or the error. onUndo: Offers Undo once done; return a promise to show undoing.
step / defaultStep / onStepChange"idle" | "confirming" | "pending" | "done" | "error" | "undoing"—step: The step, controlled or not. defaultStep: Initial active step when uncontrolled. Defaults to "idle". onStepChange: Reports active step after a change; no callback by default.
autoCancelAfter / resultFornumber (ms)6000 / 5000autoCancelAfter: ms before an unanswered question backs out on its own; 0 waits. Default 6000. resultFor: ms a result stays before the control rests again; 0 keeps it. Default 5000.
dismissOnOutsidebooleantrueA press anywhere else backs out of the question. Default true.
tone"danger" | "neutral""danger"Semantic colour of the displayed content. Defaults to "danger".
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
classNamesConfirmMorphClassNames—Classes for the named visual parts; no part overrides by default.
label (required)ReactNode—The action at rest: "Delete project".
iconReactNode—Icon element shown beside the label. Defaults to no leading icon.
promptReactNode—The question while asking: "Delete “Q3 pipeline”?"
onConfirm(() => void | Promise<unknown>)—Runs the action. Return a promise and the control shows working, then done or the error.
onUndo(() => void | Promise<unknown>)—Offers Undo once done; return a promise to show undoing.
onCancel(() => void)—Runs the cancellation action; no handler by default.
stepConfirmMorphState—The step, controlled or not.
defaultStepConfirmMorphState—Initial active step when uncontrolled. Defaults to "idle".
onStepChange((step: ConfirmMorphState) => void)—Reports active step after a change; no callback by default.
autoCancelAfternumber—ms before an unanswered question backs out on its own; 0 waits. Default 6000.
resultFornumber—ms a result stays before the control rests again; 0 keeps it. Default 5000.
disabledboolean—Prevents interaction with the control. Defaults to false.
classNamestring—Classes on the documented visual root; no override by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.

Built from

Used in

Dependencies

lucide-react, motion

Import

import { ConfirmMorph } from "@beamline/confirm-morph";

Get it

Confirm morph is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Actions

  • Consequence preview: A risky action that shows what it will do before it runs: one headline sentence, what blocks it and what it also reaches as bands, then the rest as cards…
  • Theme switch: The light/dark control: the page changes in one of four transitions starting from the button (reveal, eclipse, split, rise), and the icon turns between…
  • Swipe actions: Row actions behind a swipe on touch screens and a two-finger swipe on a trackpad, and at the row's end for pointer and keyboard (a ⋯ menu in a narrow…
  • Hold to confirm: Confirms a costly action by holding instead of clicking: a fill sweeps across while held and drains if let go early; pointer, touch, Space and Enter all…
  • Split button: One obvious action joined to a menu of close alternatives; both halves are real buttons and the menu uses the shared menu rows.
  • Copy button: Copies a value and confirms in place: the icon becomes a check and the label says Copied; a refused copy says so instead of pretending.
  • Button: The action control: five weights and a brand fill, a buy/sell tone, sm/md/lg and a 44 px touch size, icon-only, a loading state that keeps its size and…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.