Community project. This is not an official government website.

Run by volunteers. Lampung Design System is built by an open source community. No government agency runs or endorses it.

Official services use go.id. Government websites in Indonesia end in .go.id. Never enter your national ID number on a site you are unsure of.

Range slider

Range slider

Two thumbs on one track for a minimum and a maximum, with the accent fill between them. The thumbs can never cross; each is a native range input.

Usage

Use it when

  • Filtering by a span: price from and to, credits per term, score between, duration.
  • Both ends matter and an approximate position is good enough while browsing.

Use something else when

  • A single value on a scale: use Slider.
  • Exact bounds people type (a payment between two amounts): use Amount field. Two amount fields in a .form__row.
  • A date span: use Calendar. The calendar supports a range with .is-range days.
  • A few fixed brackets (Under 50k, 50k to 100k, Over 100k): use Chips.

Where it goes. In filter panels (drawer on wide screens, sheet on phones), full width of the panel, with the current span shown in the label row above it.

Examples

Credits per termDrag either thumb, or Tab to it and use the arrow keys. The lower thumb stops one step below the upper one.
Credits per term 16 to 21
<div class="field" style="max-width: 420px; width: 100%;">
  <span class="field__label">Credits per term <span id="rs-credits">16 to 21</span></span>
  <div class="range" data-lds-range oninput="const [lo, hi] = this.querySelectorAll('input'); document.getElementById('rs-credits').textContent = lo.value + ' to ' + hi.value;">
    <div class="range__track"><div class="range__fill"></div></div>
    <input type="range" min="12" max="24" value="16" aria-label="Minimum credits">
    <input type="range" min="12" max="24" value="21" aria-label="Maximum credits">
  </div>
</div>
Price filterLarger steps for money; the label shows formatted values.
Price Rp 50.000 to Rp 250.000
<div class="field" style="max-width: 420px; width: 100%;">
  <span class="field__label">Price <span id="rs-price">Rp 50.000 to Rp 250.000</span></span>
  <div class="range" data-lds-range oninput="const [lo, hi] = this.querySelectorAll('input'), f = (v) => 'Rp ' + Number(v).toLocaleString('id-ID'); document.getElementById('rs-price').textContent = f(lo.value) + ' to ' + f(hi.value);">
    <div class="range__track"><div class="range__fill"></div></div>
    <input type="range" min="0" max="500000" step="25000" value="50000" aria-label="Minimum price">
    <input type="range" min="0" max="500000" step="25000" value="250000" aria-label="Maximum price">
  </div>
</div>

Anatomy

PartWhat it is
.rangeRequired. 28 px tall positioned box with data-lds-range.
.range__trackRequired. The 4 px gray track.
.range__fillRequired. The accent fill inside the track; the JS sets its left and right.
input[type=range] (two)Required. Lower and upper thumbs with the same min, max and step, each with its own aria-label. Only the thumbs take pointer events.

States

StateHow
draggingThe held thumb scales to 1.1 (WebKit and Blink).
focus-visibleFocus ring around the focused thumb (WebKit and Blink).
touching valuesWhen the lower would reach the upper, the JS pushes it back one step (and the other way round).

Motion and microinteractions

  • Thumbs follow the pointer 1:1; the fill updates on every input event.
  • Press: thumb scale 1.1 on --spring-snappy (360 ms).
  • Apply a filter on lds:change with a short debounce, or on release, so results do not flash while dragging.
  • Reduced motion: the press scale becomes 120 ms linear.

Accessibility

  • Two native range inputs: each is focusable, keyboard operable and announced with its own aria-label ("Minimum credits", "Maximum credits").
  • Show the current span as text (in the label row) so it is visible and readable without dragging.
  • As with the single slider, Firefox shows no focus ring on the thumbs; check keyboard focus there.

Do and don't

Do

  • Start at the full range or the most common span.
  • Label the span in words people use ("16 to 21").

Don't

  • Use two separate sliders for a min and max.
  • Hide the values; dragging to an unknown number is guesswork.

Behavior and code

Plain HTML. data-lds-range on .range: positions .range__fill between the thumbs, keeps the lower below the upper by one step, and fires lds:change with { min, max }. The value text is yours.