Bencho Originals
Slide to confirm

Features

  • A bright wash stretches from the left edge to the grip, so the grip reads as the end of a growing pill.
  • The label dims as the wash covers it, and the arrow fades out over the last stretch.
  • Rubber-bands at both ends: you can tug past the start or the end and it springs back.
  • Let go past 86% and it locks, shows ✓ and your doneLabel, calls onConfirm, then resets after resetAfter.
  • Dragging still tracks the finger when the component sits inside a scaled container.

API reference

<SlideToConfirm /> from components/bencho/slide-to-confirm.tsx

PropTypeDefaultDescription
labelstring"Slide to confirm"Track label. It's also the grip button's accessible name.
doneLabelstring"Confirmed"Text shown next to the check after confirming.
onConfirm() => void—Called once when the slide completes, by drag or keyboard.
resetAfternumber (ms)1600How long the confirmed state holds before the track resets.

Keyboard interactions

TabFocuses the grip.
Enter / SpaceConfirms straight away, the same as a full slide.

Accessibility

  • The grip is a real <button> labelled with label, so screen readers announce what confirming does.
  • Keyboard users skip the gesture and confirm with Enter or Space.
  • While confirmed, the grip is disabled so the action can't fire twice.

Sound & haptics

Silent by design: no audio and no vibration. All of the feedback is visual, so it works anywhere, muted or not.

Files

Written from scratch for sher.md and inspired by bencho.dev. It contains none of bencho's code or assets.