Slider
Forms & Input

Slider

Range slider with an optional numeric readout. The filled portion of the track uses the primary color.

Props

Slider extends InputHTMLAttributes<HTMLInputElement>, wrapping a native <input type="range">.

SliderProps props
PropTypeDefaultDescription
valuenumber—Controlled value.
defaultValuenumber—Initial uncontrolled value.
onChange(value: number) => void—Change handler.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step increment.
showValueboolean | (value: number) => string—Show numeric readout. Pass a function to format with units.
disabledboolean—Prevents interaction.

Examples

Basic

Basic slider

With showValue

60
Slider with readout

With showValue formatter

75%250ms
Slider with formatted units

Interactive

50
Interactive slider
ImportTSX
import { Slider } from "@solarius/onset";
import type { SliderProps } from "@solarius/onset";