Slider

A range input using <input type="range">.

Standalone

<link rel="stylesheet" href="https://esm.sh/@erikt/ui/slider.css" />

Default

<input type="range" />

Filled

Set --pct on the element to show a filled track. Update it on input events to keep it in sync with the value.

<input
  type="range"
  style="--pct: 0.5"
  oninput="
    this.style.setProperty(
      '--pct',
      (this.value - this.min) / (this.max - this.min),
    )
  "
/>

Step

Use step to snap the thumb to discrete intervals.

<input type="range" step="25" />

Disabled

<input type="range" disabled />

API reference

Type Classes / attributes What it does
Fill --pct: 0.5 Fills the track up to this fraction, from 0 to 1
Disabled [disabled] Fades the slider and blocks input

Search 5021 icons

Type a name to find icons from the Tabler icon set.

      Move Open Esc Close