RangeSlider
Two thumbs that cannot cross. They grow while held and lift a value bubble. Inputs.
Open playgroundAbout
RangeSlider is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { RangeSlider } from "@ashutoshswamy/smoui" and set value, defaultValue, min among its 7 props.
Install
npm i @ashutoshswamy/smouiUsage
import { RangeSlider } from "@ashutoshswamy/smoui";
<RangeSlider label="Price" defaultValue={[20, 70]} format={(v) => "$" + v} onChange={([lo, hi]) => filter(lo, hi)} />Props 7
- value
Controlled range.
[number, number]- defaultValue
Initial range when uncontrolled.
[number, number]default[25, 75]- min / max
Bounds.
numberdefault0 / 100- step
Snap increment.
numberdefault1- format
Text for the value bubble.
(value: number) => string- onChange
Called as either thumb moves.
(value: [number, number]) => void- label
Accessible name prefix.
string
More inputs components
- AddressAutocompleteType a street and pick from live suggestions. Lookups wait for a pause, show a spinner and drop stale answers. Picking confirms the full address underneath.
- AvatarPickerPick an avatar from a grid. One accent ring glides to your choice, the big preview swaps on a spring, arrow keys move across the grid and Shuffle rolls a random one.
- AvatarUploadDrop or choose a photo, then frame it under a crop circle. The stage shows the whole photo, the circle shows what you keep, and three live previews follow every move. Drag, zoom or use the arrow keys.
- CheckboxBox squashes on press, fills with the accent and draws its tick in.
- ChipA selectable pill. Selecting it tints it and slides a tick in at the front while the pill grows; an optional close button removes it.
- ColorPickerSaturation field and hue strip with jelly thumbs on springs. Edit the hex, pick a swatch, or use arrow keys.