1. Home
  2. Labs
  3. Detent Slider
Sep 11, 2026

Detent Slider

A slider that sticks at the ends and stretches when you keep pulling.

This is a small fold control with magnet ends. Drag toward open or closed and the thumb seats itself.

How to use

pnpm add react-aria-components tailwind-variants

The lab ships as a compound control: Root, Label, Track, Thumb. React Aria owns focus and the hidden range input. A magnet simulator owns drag feel and paints transform plus stretch CSS variables on the thumb. Keyboard arrows step 0 → 0.5 → 1 through the same sim path.

Wire it with a label and track, pass ariaValueText if you want spoken names near the ends, and listen to onSimulationUpdate only when you need a live preview. Prefer not to setState every frame outside the lab.

Inspired by

iPhone Duo