Free · MIT licence · No dependencies

Effort Slider Free React component

A stepped slider in a clean little card, the kind AI apps use for "effort" or "quality" settings. The thumb follows your finger, then snaps to the nearest step with a springy bounce while the label rolls to the new value. Full keyboard support.

  • React
  • CSS
  • Slider
  • Input
  • Snap
Effort Slider

Get the code

Install in one linenpx shadcn@latest add https://alphenex.com/r/effort-slider.json

Works with any React project through the shadcn CLI. Prefer to paste it yourself? Copy the two files below into components/alphenex/. No Tailwind or animation library needed.

import EffortSlider from '@/components/alphenex/effort-slider';

<EffortSlider steps={['Low', 'Medium', 'High', 'Max']} />

How the effort slider works

The thumb and fill are positioned from one CSS variable: the ratio from 0 to 1 along the track. While you drag, the ratio follows the pointer exactly and transitions are switched off.

On release the ratio jumps to the nearest step, and the transitions switch back on with an overshooting curve, which is what makes the thumb bounce into place. The step name re-mounts with a short slide-up animation.

It is a real slider for assistive technology: role="slider", the current step as aria-valuetext, and arrow keys, Home and End all work.

Frequently asked questions

Yes. Pass any array of step names as steps, for example ["Draft", "Good", "Best"].

Want motion like this on your website?

We design and build custom websites with motion, 3D and SEO built in. Websites from $500.

More free components

Explore our work