Elastic slider

A native range input with give: drag past an end and the track stretches toward you, then springs back.

Volume40%

Features

  • A native range input over a drawn track, so keys, screen readers and forms work as usual.
  • Drag past an end and the track stretches toward the pointer like a rubber band (the give shrinks as you pull), then springs back.
  • formatValue writes the value beside the label.

Use it for

  • Scrubbing through results or steps.
  • Volume, zoom, any bounded value.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

API

PropTypeWhat it does
labelstringShown and read.
min / max / step / valuenumberAs on a range input.
onValueChange(v: number) => voidEach change.
formatValue(v) => ReactNodeHow the value reads.

Accessibility

Source

The code is in src/kit/elastic-slider.tsx in runets, MIT licensed.