- Docs
- Components
- 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
Playground
Every prop, live, and the code it takes.
import { Slider } from "@qeetrix/react";
<Slider
label="Seats"
min={0}
max={500}
step={10}
defaultValue={120}
showValue
/>02
A value
A number on a scale, with its value shown, formatted for the locale.
<Slider label="Session length" showValue min={1} max={24} defaultValue={8} format={{ style: "unit", unit: "hour", unitDisplay: "long" }} />03
A range
An array value: a thumb for each, named after the label ("Seats, minimum").
<Slider label="Seats" showValue min={0} max={500} step={10} defaultValue={[50, 250]} />04
Money and per cent
format takes Intl's options: rupees in lakhs, a percentage.
<Stack gap="xl">
<Slider label="Credit limit" showValue min={0} max={1000000} step={10000} defaultValue={250000} format={{ style: "currency", currency: "INR", maximumFractionDigits: 0 }} />
<Slider label="Discount" showValue min={0} max={0.5} step={0.01} defaultValue={0.12} format={{ style: "percent" }} />
</Stack>05
Description and error
On its own it's a field: a description, and an error that replaces it.
<Stack gap="xl">
<Slider label="Password length" showValue min={8} max={64} defaultValue={12} description="Twelve or more is recommended." />
<Slider label="Password length" showValue min={8} max={64} defaultValue={8} error="Acme's policy needs at least 12." />
</Stack>