Skip to main content
  1. Docs
  2. Components
  3. Forms

Slider

A number, or a range, on a scale: where it lies matters more than its exact digits.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<input type="range">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

slider.tsx
// From the package: a build keeps only what it uses.
import { Slider } from "@qeetrix/react";

// Or from its own path.
import { Slider } from "@qeetrix/react/slider";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
labelReactNode—The label; without one, aria-label.
value · defaultValuenumber | number[]—A value, or an array for a range: one thumb each.
onValueChange · onValueCommitted(value, details) => void—As it moves; once it's let go.
min · max · step · largeStepnumber0 · 100 · 1 · 10The scale; Page Up and Down take largeStep.
showValuebooleanfalseThe formatted value at the header's end.
formatIntl.NumberFormatOptions—Currency, per cent, a unit; in the provider's locale.
getAriaValueText(formattedValue: string, value: number, index: number) => stringthe formatted valueWhat a thumb says when the number alone doesn't: a log scale, a unit.
description · errorReactNode—On its own it's a field; inside a Field, the Field's.
disabled · name…—As on a form control.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
slider<div>The root.
slider-header<div>slider-label and slider-value.
slider-control<div>The area that takes the pointer.
slider-track<div>The 4px track.
slider-indicator<div>The range.
slider-thumb<div>A thumb; it holds the input with the slider role.

04

Save once it's let go

onValueCommitted fires when the drag ends: one save, not a hundred.

session.tsx
<Slider label="Session length" showValue min={1} max={24} defaultValue={policy.hours} onValueCommitted={(hours) => savePolicy({ hours })} />
Next — SliderAccessibility