Forms | Slider
Slider#
Description#
- A bare slider: the track, the thumb and nothing else. It is what goes inside
SliderControland what a settings row or the photo viewer needs. - Uses a native
input type="range": keyboard (arrows, Home, End, PgUp/PgDn), thesliderrole and itsaria-value*are provided by the browser. labelis required: a nameless slider is announced as “slider, 47” without saying what it controls.
Props#
modelValue(number) — The current value. Required.label(string) — What it controls, already translated. It is its accessible name. Required.min(number) — Minimum value. Defaults to:0.max(number) — Maximum value. Defaults to:100.step(number) — Step between values. Defaults to:1.valueText(string | ((value: number) => string)) — What is heard instead of the number, or how to build it from it.disabled(boolean) — Disables the slider. Defaults to:false.id(string) — Theidof theinput.describedBy(string) — Theidof the text that explains it.lazy(boolean) — Reports on release instead of on every step. Defaults to:false.
Emits#
update:modelValue— Emits the new value on every step (or on release, withlazy).change— Emits when the thumb is released or keyboard interaction ends, with the final value.
Usage#
| |
Notes#
- The
startandendslots are the labels at the ends: “Slower” and “Faster”, or the low and high volume icons. valueTextis used asaria-valuetextand is what a screen reader hears instead of the number.- With
lazyset totrue,update:modelValueis emitted only once on release, for what is costly to apply on every movement.