Toggle Sidebar B
AppearanceLight & dark mode D

Slide Commit

Slide-to-confirm control with a handle that squashes against the wall, unfurls into a done pill on success and springs home with a shake on failure.

Default

Drag the handle to the end, or focus it and press End. Change the outcome in the panel to see the error path.

Dark previewReplay previewOpen in new tab

Customize

Outcome
Latency1200ms
Track
Handle
Success
Danger
Width280px
Height56px
Radius28px
Speed50
Return Bounce0.38
Landing Dip0.026
Hold1500ms

API Reference

SlideCommit

PropTypeDefaultDescription
labelstring'Slide to pay'The instruction centred in the pill. The capsule wipes it as you drag.
doneLabelstring'Paid'The words beside the check once confirmed.
errorLabelstring'Payment failed'Replaces the instruction, in the danger colour, after a rejected promise.
onConfirm() => void | Promise<unknown>-Called when the handle reaches the end. Return a promise to show the spinner. It unfurls on resolve and springs home on reject.
trackColorstring'#262626'The pill behind the handle.
handleColorstring'#f5f5f5'The handle and the ground it paints. The arrow colour is picked to read on it.
successColorstring'#22c55e'Fill of the done pill.
dangerColorstring'#e5484d'Tint of the handle and error label after a reject.
widthnumber280Track width in pixels. The travel scales with it.
heightnumber56Track height in pixels. The handle is 8px smaller.
radiusnumber28Track corner radius. The handle corner is 4px smaller so the two stay concentric.
speednumber50How fast the unfurl and the return take over once you let go.
returnBouncenumber0.38Energy left when the handle returns to the wall. 0 stops dead, 0.38 fills the 8% squash.
landingDipnumber0.026How much the track dips as the done pill lands. 0 removes it.
holdMsnumber1500How long the done pill stands before it closes back. 0 keeps it until the component remounts.
disabledbooleanfalseDims the control and ignores input.
EventDescription
doneEmitted when the done pill unfurls.
errorEmitted with the rejection reason. The component swallows it otherwise.
SlotDescription
iconReplaces the arrow in the handle.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
Arrow Right + Arrow UpMoves the handle forward by a tenth of the travel. Reaching the end confirms.
Arrow Left + Arrow DownMoves the handle back by a tenth of the travel.
EndConfirms at once.
Home + EscapeCancels a drag or returns the handle to the start.
  • The handle is a slider with aria-valuenow and aria-valuetext tracking its position. A live region announces working, done and failed.
  • With prefers-reduced-motion the handle returns with a short tween instead of a spring and the spinner breathes instead of turning.