Dot Slider
The filled part of the track is a lit bar in the accent, the rest a faint line of dots; the thumb is a key that presses a dot shorter as you hold it, and the value reads in a small dot face beside the track. A real range input lies over the drawing, so dragging, clicking, the keyboard and screen readers all work natively. The thumb follows the hand exactly and springs to a clicked or keyed value.
Needs: None. Canvas 2D over a native range input.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | – | The value. Leave unset to let the slider keep its own. |
| defaultValue | number | – | The value at first, when value isn't set. |
| onChange | (value: number) => void | – | Called as the value changes, while dragging too. |
| onCommit | (value: number) => void | – | Called once a change is done: the pointer let go, or a key let up. |
| min | number | 0 | The lowest value. |
| max | number | 100 | The highest value. |
| step | number | 1 | The step between values. |
| format | (value: number) => string | – | How the value reads, beside the track and to screen readers. |
| readout | boolean | true | Show the value beside the track. |
| ticks | boolean | true | A dot under the track for each step, when there's room. |
| tone | string | – | The filled track's colour. The page's accent by default. |
| pitch | number | 3 | Size of one dot in px. The slider is 11 dots tall. |
| disabled | boolean | false | Can't be moved. |
| label | string | "Value" | Read out by screen readers. |
| className | string | – | Class on the slider. It fills its container's width. |
| style | CSSProperties | – | Style on the slider. |