Choose a number or a range by dragging: a price filter, a salary band, deal probability, image opacity. Marks, a value bubble, synced number inputs, and Intl formatting with the provider locale.
Used to weight this deal in the revenue forecast.
Installation
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { Field, Slider } from "@vamos-ui/react";
<Field label="Price per night">
<Slider
defaultValue={[120, 340]}
min={40}
max={600}
step={10}
formatOptions={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }}
withInputs
/>
</Field>Keyboard: arrows ± step, Page Up / Page Down ± 10 steps, Home / End to the bounds. aria-valuetext carries the formatted value ("$120", "₺1.250").
In server components pass formatOptions, not formatValue — functions can't cross into client components.
Examples
Range with inputs
Two values = range. Thumbs are named "Price per night Minimum / Maximum"; typed values are snapped to step and can't cross. names gives each thumb its own form field.
Marks
Numbers or { value, label }. showValue="always" pins the bubble; "never" hides it when the marks already say it.
Snaps to the five levels in your career framework.
Filter on release
onValueChange for the live preview, onValueCommit to filter or call the server once per gesture.
- Moda loft with sea view$145
- Karaköy design flat$210
- Balat townhouse$132
Sizes & states
Small, disabled, read-only, a Field error and vertical orientation.
Set by your manager.
Discounts above 40% need approval.
API
Slider
| Prop | Type | Default |
|---|---|---|
value / defaultValueOne number = single, two = range. | number[] | [min] |
onValueChangeContinuously while dragging. | (value: number[]) => void | — |
onValueCommitOn release / key up — wire filters here. | (value: number[]) => void | — |
min / max / stepBounds and step. | number | 0 / 100 / 1 |
minStepsBetweenThumbsMinimum gap in a range. | number | 0 |
marksTicks under the track; labels optional. | (number | { value, label })[] | — |
formatOptionsFormatting with the provider locale (currency, percent, unit). | Intl.NumberFormatOptions | — |
formatValueCustom formatter (client components only). Wins over formatOptions. | (n: number) => string | — |
showValueValue bubble above the thumb (hover, focus and drag). | "never" | "hover" | "always" | "hover" |
withInputsNumber inputs under the track, commit on blur / Enter. | boolean | — |
sizeTrack and thumb size. | "sm" | "md" | "md" |
orientationVertical needs a height on the parent. | "horizontal" | "vertical" | "horizontal" |
thumbLabelsAccessible name per thumb. Range default: Minimum / Maximum (dictionary slider.*). | string[] | — |
nameForm name; range values submit as repeated entries (formData.getAll(name)). | string | — |
namesSeparate form names per thumb, e.g. ["priceMin", "priceMax"]. | string[] | — |
invalid / readOnly / disabled / requiredState; inherited from Field. | boolean | — |
labelsBuilt-in string overrides. | Partial<{ min, max, value }> | — |