Skip to content

Slide to Confirm

Drag a tactile handle across its track to confirm an action.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import SlideToConfirm from "./SlideToConfirm";
export default function Example() {
return (
<SlideToConfirm
label={"Slide to unlock"}
completedLabel={"Unlocked"}
threshold={0.9}
resetAfter={2500}
accentColor={"#d5bee6"}
background={"#27212e"}
disabled={false}
/>
);
}

Using Slide to Confirm

Use label to name the action and completedLabel to explain its successful confirmation. onConfirm connects the gesture to your application.

threshold controls how far the handle must travel. Use disabled while the action cannot be accepted and resetAfter when the control should become available again.

Props

NameTypeRequiredDefaultDescription
labelstringNo"Slide to confirm"Accessible action label and visible instruction.
completedLabelstringNo"Confirmed"Visible and announced confirmation label.
onConfirmfunctionNoundefinedCalled once after releasing the handle beyond the threshold, or native keyboard activation.
thresholdnumberNo0.9Required travel as a fraction from 0.5 to 1.
resetAfternumberNo2500Delay before permitting another confirmation, in milliseconds. Zero keeps the completed state.
accentColorstringNo"#d5bee6"Handle and progress fill colour.
backgroundstringNo"#27212e"Track background.
disabledbooleanNofalseDisable pointer and keyboard confirmation.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

A recessed password field pairs a reveal control with an optional strength indicator.

Editable tags collect inside a softly framed input with individual remove controls.

A recessed search field expands into a polished capsule as you type.

Faceted stars lift into selection with a small marker beneath the chosen rating.