Component API

<range-slider>

Open live example

A form-associated numeric range slider, usable standalone or inside a
native <form>. Wraps a native <input type="range"> (kept for its free
keyboard, drag, and screen-reader support) restyled to match this
package's track/fill visual language (stat-meter, percent-bar-chart)
instead of the browser-default appearance. Purely a value control — no
built-in label; wrap in form-field for a labeled field, or render a
value readout next to it (see the playground example), matching
autocomplete-input/form-select.

Install

import "@f-ewald/components/range-slider.js";

Usage

<range-slider min="100" max="5000" step="50" value="1000"></range-slider>
<script type="module">
  document.querySelector("range-slider").addEventListener("input", (e) => {
    console.log(e.detail.value);
  });
</script>

Attributes / properties

PropertyAttributeTypeDefaultDescription
minminnumber0Minimum value.
maxmaxnumber100Maximum value.
stepstepnumber1Step increment.
valuevaluenumber0Current value.
disableddisabledbooleanfalseDisables interaction; merged with an ancestor <fieldset disabled>.
namenamestring""Form field name.

Events

EventDescription
inputFires continuously while dragging/typing; detail: { value }.
changeFires once the value is committed (drag released, arrow key released); detail: { value }.

Slots

None.

CSS custom properties

Custom property
--ui-button-accent
--ui-button-background
--ui-button-highlight
--ui-focus-ring
--ui-primary
--ui-radius-circle
--ui-radius-pill
--ui-surface
--ui-surface-muted
--ui-text-muted