Confirm button
A Button for an action that is hard to take back, confirmed in place. It grows into a question with Cancel beside the action, shows a spinner while the action runs, then says how it went, with Undo.
Examples
Default
Give it the action as onConfirm and the way back as onUndo. It asks, shows a spinner while the action runs, then says how it went, with Undo.
The empty state needs a way back to search.
Icon only
Give an icon size an aria-label. It widens into the question, so give it a line with room to grow into, such as the name’s.
Destructive
Leave out onUndo for an action with no way back: the result says it is done and goes back to rest.
Failure
A promise that rejects shows failedLabel with Try again. This one fails the first time.
Long question
Name what goes. A question too long for one line takes its own, with Cancel and the action below it.
Sizes
Cancel and the action take the button’s size.
Installation
npx shadcn@latest add https://kinoui.com/r/confirm-button.json- Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/announce.tsxlib/notice.tsxlib/settle.tscomponents/kino/confirm-button.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Props
Data attributes
CSS variables
Accessibility
- The question is a group named by its words, and focus moves to Cancel when it opens, so Enter twice never acts.
- Escape, a press elsewhere and Tab away cancel the question; Escape and Cancel put focus back on the button.
- The second press of a double click and a held key’s repeats never answer the question.
- A polite status region says how the action went, and that Undo worked or failed.
- Focus moves to Undo, or to the result, when the action ends, and back to the button when the result goes; a disabled button stays focusable, so focus never falls to the page.
- A failure shows an alert icon and words, not a colour alone.