Props

PropTypeDefaultDescription
activeIndexnumber | nullnullThe starting slide, or a controlled value for the current slide.
onSlideComplete(index: number) => voidCalled when a slide settles into its finished position.
onSlideStart(index: number) => voidCalled when a drag or keyboard move starts.
thresholdnumber100Pixels that must be dragged before the slider snaps to the next or previous slide.
transitionnumber0.3The CSS snap duration in seconds. Ignored when spring is enabled.
scaleOnDragbooleanfalseWhether the dragged slide scales while moving.
navigateOnArrowKeysbooleantrueWhether arrow keys navigate when the slider is focused. Set to false to disable arrow-key navigation entirely.
springbooleanfalseSettle with spring physics instead of a CSS transition.
stiffnessnumber180Spring stiffness (used when spring is enabled).
dampingnumber16Spring damping (used when spring is enabled).
massnumber1Spring mass (used when spring is enabled).

By default the slider settles with a CSS transition whose duration comes from transition. When spring is enabled the settle is driven by spring physics instead — the transition prop has no effect and the CSS transition is turned off. The spring’s feel is tuned with stiffness, damping, and mass.

Passing activeIndex makes the slider controlled — update it from your own state (for example with prev/next buttons) and the slider follows. See the controlled example.

TypeScript consumers can import the props type directly:

import Slider, { type SliderProps } from 'react-touch-drag-slider'

Useful for typing wrappers around the slider or omitting props, e.g. Omit<SliderProps, 'children'>.