Slider

@sushindustries/ui

A native range input with its label - keyboard steps and form value ship in the element.

3 min read
View as MarkdownEdit on GitHub

Composing it

SliderSliderA native range input with its label - keyboard steps and form value ship in the element.@sushindustries/ui · content already returns a <label> wrapping the input and its text - label is required for exactly this reason, there is no unlabelled variant. Do not nest it inside another FieldFieldA labelled control with one line under it - the error is announced by being pointed at, not by being red.@sushindustries/ui · content or <label>; that puts two labels around one control, and a screen reader announces both.

When not to use it

For a value someone needs to type precisely - a price, a quantity, a date - a slider trades away exact entry for a gesture that is fast but imprecise. Reach for InputInputA text input, and only the drawing of one - state and labels belong to the form and to Field.@sushindustries/ui · content with type="number" there, and save SliderSliderA native range input with its label - keyboard steps and form value ship in the element.@sushindustries/ui · content for values where "close enough, seen at a glance" is the actual goal: volume, brightness, a threshold on a chart.