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.

Slider

Slider

A native range input with the system skin: a 4 px track filled in the accent up to a 28 px thumb. For a value on a continuous scale where the position matters more than the exact number.

Usage

Use it when

  • Setting a level on a scale: volume, text size, playback speed, difficulty.
  • Feedback while dragging matters more than typing an exact value (the result previews live).
  • A bounded number where the exact value is shown next to it (.slider-value).

Use something else when

Where it goes. In settings and filter panels, full width of its column with the end icons or the value beside it (.slider-row). On phones give it the full width; the thumb is a 28 px target in a 28 px tall input with room above and below.

Examples

Volume with end iconsDrag, click the track, or use the arrow keys, Page Up, Page Down, Home and End.
<div class="slider-row" style="max-width: 420px; width: 100%;"><span class="ic" aria-hidden="true">volume_mute</span><input class="slider" type="range" min="0" max="100" value="64" aria-label="Volume"><span class="ic" aria-hidden="true">volume_up</span></div>
With the value shownAn exact readout when the number matters. The value updates as you drag.
1x
<div class="field" style="max-width: 420px; width: 100%;">
  <label class="field__label" for="sl-speed">Reading speed for listening questions</label>
  <div class="slider-row"><input class="slider" id="sl-speed" type="range" min="0.5" max="2" step="0.25" value="1" oninput="document.getElementById('sl-speed-out').textContent = this.value + 'x'"><output class="slider-value" id="sl-speed-out" for="sl-speed">1x</output></div>
</div>

Anatomy

PartWhat it is
.slider-rowOptional row: an icon or label at each end and the slider between, 14 px apart.
input.slider[type=range]Required. Native range with min, max, step, value and a name (aria-label or a <label>). The JS keeps --pct in sync for the fill.
.slider-valueOptional. The current value at the end, tabular numbers, right-aligned. Use an <output>.

States

StateHow
dragging (:active)The thumb grows to 1.1 (WebKit and Blink).
focus-visibleA 2 px focus ring around the thumb with a 3 px gap (WebKit and Blink).
disabledNative disabled; dim the row and say why nearby.

Motion and microinteractions

  • The thumb follows the pointer 1:1; the fill is a gradient stop at --pct, updated on every input event, so it never lags.
  • Press: the thumb scales to 1.1 on --spring-snappy (360 ms) and back on release.
  • Values that preview live (volume, text size) should apply on input; expensive ones (a search filter) on change.
  • Reduced motion: the press scale becomes a 120 ms linear change.

Accessibility

  • A native <input type="range">: arrow keys step, Page Up and Page Down jump, Home and End go to the ends; screen readers announce the value.
  • Name it with a <label for> or aria-label. When the number alone is unclear, set aria-valuetext ("1.25 times speed").
  • End icons are decorative (aria-hidden); the <output for> shows the value visibly.
  • Firefox does not show a focus ring on this slider: the system removes the outline and styles the focus ring only on the WebKit thumb. Check keyboard focus there.

Do and don't

Do

  • Show the value when people need the exact number.
  • Choose a step that matches what people can tell apart.

Don't

  • Use a slider for values people must hit exactly; give them a field.
  • Restyle the track or thumb; the skin is part of the system.

Behavior and code

Plain HTML. Automatic for every input.slider: keeps the --pct fill in sync on input (Firefox uses its own ::-moz-range-progress). Update .slider-value yourself.