Skip to content

Inline confirm

A row's risky action in two steps, in place, that works with no script.

<ul class="cap-inline-confirm-specimen" data-mount="rows"></ul>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/inline-confirm.css";

Usage

<form class="cap-inline-confirm" method="post" aria-labelledby="q1">
  <input type="hidden" name="_action" value="remove" />
  <span class="cap-inline-confirm-question" id="q1">Remove Sam Lee?</span>
  <span class="cap-inline-confirm-actions">
    <button type="submit" class="cap-btn" data-size="sm" data-variant="danger" aria-describedby="q1">Yes, remove member</button>
    <a href="?" class="cap-btn" data-size="sm" data-variant="quiet">Cancel</a>
  </span>
</form>

Examples

Running: the confirm says so and Cancel is withdrawn

<div data-mount="pending"></div>

API reference

InlineConfirm

PropTypeRequiredDoes
labelReactNodeYesThe first button's words ("Remove member"). Name the thing when the row does not.
labelDetailstringWords only a screen reader hears after the label, naming what it acts on (" Alex Rivera").
questionReactNodeYesThe question in place of the button ("Remove Alex Rivera?").
confirmLabelReactNodeYesThe second step's button ("Yes, remove member"): the action itself.
cancelLabelReactNode
openHrefstringYesWith no script the first step is a link to this address (the page with the question open, "?confirm=<id>"), and Cancel a link to closeHref.
closeHrefstringYes
defaultOpenbooleanOpen from the start: the page was asked for at openHref.
pendingbooleanThe action is running: the confirm says pendingLabel and Cancel is withdrawn.
pendingLabelReactNode
tone"danger" | "default"danger (default) for an action that loses something; default for one that does not.
size"sm" | "default"
formFormComponent | "form"The form element (React Router's Form, or a read-only guard); default a plain <form>.
method"post" | "get"
actionstring
childrenReactNodeThe hidden inputs that name the action ("_action", "memberId").

Parts and data attributes

ClassIs
.cap-inline-confirmthe root
.cap-inline-confirm-actionsa part
.cap-inline-confirm-questiona part

Accessibility

KeyDoes
Enter or Space on the first buttonOpens the question; focus on Cancel
Enter on CancelCloses it; focus back on the first button
Enter on the confirmSends the form

The open form is named by its question (aria-labelledby). Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.