Bending Rail, animated React component
A slider whose rail follows the knob. Pull the knob off the groove and the rail bends toward it while a ghost knob keeps the value; let go and it twangs straight on a spring.
- Pro
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Volume40%
Pull the knob up or down, then let go.Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| label | string | "Volume" | Label shown above the rail and used as the slider's accessible name. |
| min | number | 0 | Lowest value. |
| max | number | 100 | Highest value. |
| defaultValue | number | 40 | Starting value. |
| unit | string | "%" | Suffix shown after the value. |
| accent | string | "#0071e3" | Colour of the filled run, the tether and the ghost knob. |
| onChange | (v: number) => void | — | Called whenever the rounded value changes. |
| autoplay | boolean | false | Tugs the knob around by itself until someone grabs it. |