Range slider

Native range inputs with values, progress, marks and states.

When to use

Use a range slider for an approximate numeric choice within known bounds, such as volume or duration. Use a numeric Input when users need to enter a precise value directly.

Default

Apply .range-slider-input to a labelled native range input. Its output supplements the native value.

40%
HTML
<div class="range-slider">
	<div class="range-slider-header">
		<label class="form-label" for="completion">Completion</label>
		<output class="range-slider-output" for="completion">40%</output>
	</div>
	<input
		class="range-slider-input"
		id="completion"
		name="completion"
		type="range"
		min="0"
		max="100"
		step="5"
		value="40"
		style="--range-slider-progress: 40%" />
	<div class="range-slider-marks" aria-hidden="true">
		<span>0%</span>
		<span>100%</span>
	</div>
</div>

On input, update <output> and set --range-slider-progress to (value - min) / (max - min) * 100%. The package provides no JavaScript.

Marks

Use .range-slider-marks for reference values. Set aria-hidden when native semantics provide the same information.

30 min

Invalid and disabled

For validation, combine .is-invalid, aria-invalid="true" and aria-describedby. Use native disabled.

2

Choose at least three people.

65

Right to left

The fill follows direction; the browser retains native behavior and semantics.

70

Accessibility and behavior

  • Label the native range input.
  • Use native min, max, step, value and disabled; do not add a slider role.
  • Update output and progress without replacing native interaction.
  • Synchronize aria-valuetext only when the spoken value differs.

CSS variables

Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.

TokenDefaultPurposeScope / state
--range-slider-gapvar(--spacer-1)Space between child elements..range-slider
--range-slider-header-gapvar(--spacer-3)Space between the label and displayed value..range-slider
--range-slider-progress0%Filled percentage; update this alongside the native input value..range-slider
--range-slider-target-size2.75remInput hit area height..range-slider
--range-slider-track-size0.5remTrack thickness..range-slider
--range-slider-track-bg-colorvar(--control-border-color)Unfilled track color..range-slider
--range-slider-fill-colorvar(--primary)Filled track color..range-slider
--range-slider-thumb-size1.5remThumb diameter..range-slider
--range-slider-thumb-bg-colorvar(--primary)Thumb background..range-slider
--range-slider-thumb-border-width0.125remThumb border thickness..range-slider
--range-slider-thumb-border-colorvar(--on-primary)Thumb border color..range-slider
--range-slider-thumb-box-shadowvar(--shadow-sm)Thumb shadow..range-slider
--range-slider-value-colorvar(--text-color)Displayed value text color..range-slider
--range-slider-marker-colorvar(--text-muted)Marker label color..range-slider
--range-slider-disabled-track-bg-colorvar(--disabled-border-color)Unfilled track color while disabled..range-slider (disabled)
--range-slider-disabled-fill-colorvar(--disabled-text-color)Filled track color while disabled..range-slider (disabled)
--range-slider-disabled-thumb-bg-colorvar(--disabled-text-color)Thumb background while disabled..range-slider (disabled)
--range-slider-disabled-thumb-border-colorvar(--disabled-bg-color)Thumb border while disabled..range-slider (disabled)
--range-slider-invalid-colorvar(--error)Accent color for invalid controls and feedback..range-slider (invalid)
--range-slider-focus-outline-widthvar(--focus-outline-width)Focus ring thickness..range-slider (focus)
--range-slider-focus-outline-stylevar(--focus-outline-style)Focus ring line style..range-slider (focus)
--range-slider-focus-outline-colorvar(--focus-outline-color)Focus ring color..range-slider (focus)
--range-slider-focus-outline-offsetvar(--focus-offset)Distance between the focus ring and control..range-slider (focus)
--range-slider-transition-durationvar(--transition-duration)Duration of visual state transitions..range-slider
--range-slider-transition-easingvar(--transition-easing)Timing curve for visual state transitions..range-slider