Overview
Reference usage
InlineConfirm keeps a confirmation in document flow for reversible actions. It uses a labelled role="group" that reads prompt, then a quiet icon-only X, then the confirm action, the strip's one labelled button, at the trailing edge. The X dismisses; cancelLabel (default 'Cancel') is its accessible name, not visible text, so a consumer can name it ("Keep editing"). The strip focuses the X on open and restores focus to the trigger when dismissed.
Use presentation="two-press" for an irreversible action. It renders one named action, arms on the first press, resets after three seconds or Escape, and never renders a competing Cancel action. The action is primary at rest and danger once armed; with destructive it is solid danger at rest, the region's one primary and plainly dangerous. Once armed it also draws a danger ring, so arming is a visible step.
Usage
Remove this workspace?
When to use
- Confirming a reversible action in the same flow as its trigger.
- The action requires modal interruption or extensive consequences; use ConfirmDialog.
Examples
Basic inline confirmation
Confirm a destructive action without leaving the current flow.
Props
Name | Type | Default | Description |
|---|---|---|---|
prompt | text | ||
confirmLabel required | text | Label for the confirming action. | |
cancelLabel | text | 'Cancel' | Accessible name of the strip's dismissing X, a quiet icon-only button; it is not visible
text. Defaults to 'Cancel'. |
destructive | boolean | false | Marks the confirming action as destructive: the strip's confirm button and a two-press action
take the solid danger face, at rest and armed. An armed two-press action, destructive or not,
also draws a danger ring, so arming is a visible step. A non-destructive two-press action is
primary at rest and danger once armed. Defaults to false. |
flush | boolean | false | The strip sits flush inside a bordered container. At the container's start or end it drops
its own rule there instead of doubling the container's edge. Defaults to false. |
open bindable | boolean | false | Whether the confirmation is open. Bindable, and component-owned on
close: confirming, clicking the dismissing X, and pressing Escape all set this
to false before calling onConfirm/onCancel, so a bound parent
observes the confirmation as already closed by the time either
callback runs—neither callback can veto or delay that close. Defaults
to false. |
onConfirm | () => void | Called when the user confirms the action, after open is already set to false. | |
onCancel | () => void | Called when the user cancels the action (via the dismissing X or Escape), after open is already set to false. | |
children | snippet | Additional content rendered below the prompt, above the confirm/cancel actions, while the confirmation is open. | |
presentation | 'strip' | 'two-press' | 'strip' | The in-flow strip (default) or a single guarded action button. |
armed bindable | boolean | false | Bindable armed state for two-press presentation. |
requestKey | text | Request identity; changing it disarms two-press presentation. | |
disabled | boolean | false | Disables and disarms two-press presentation. |
blocked | boolean | false | Blocks interaction while keeping the action focusable for an explanatory reason. |
mutating | boolean | false | Marks the two-press action as one that changes something, so a stale StaleRegion makes it inert. |
requiresSecondPress | boolean | true | Requires a second press; defaults to true in two-press presentation. |
ariaDisabled | boolean | Explicit aria-disabled value for a blocked action. | |
armedLabel | text | Full accessible label shown after the first press. | |
armedFace | text | The words drawn on the button once armed, when fewer than armedLabel ("Press again" for
"Press again to refund $42.00"). The button stays as wide as it was at rest, so a neighbour in
a row never moves, while armedLabel remains its accessible name; start the face with the
words of the name. Defaults to armedLabel. | |
armedFaceNarrow | text | A shorter armed face for a narrow place, which must be the start of armedFace ("Press
again" for "Press again to refund"). The rest of the face is drawn in its own box
(.cinder-inline-confirm__face-more) and the resting button holds room for the words in
data-cinder-reserve-narrow: a host's container query hides the box and reserves the short
words, so the resting button pays only for what it will draw there. Where the full face is
more than 10 characters wider than confirmLabel ("Press again to approve" after "Approve"),
the short face is drawn and reserved at every width, so a short resting word is never a long
pill. | |
armedHint | text | Status text shown while the two-press action is armed. | |
armedEscapeHint | text | Optional keyboard instruction shown beside the armed status on fine pointers. | |
loading | boolean | false | Shows a loading state on the action button. |
loadingLabel | text | Accessible loading label for the action button. | |
ariaDescribedBy | text | Id referenced by the action button's aria-describedby. | |
hintClass | text | Additional class merged with the two-press status hint. | |
hintId | text | Id assigned to the two-press status hint. |