Input
Range Input
NewA from-to pair for budgets and prices with a two-thumb slider and quick range chips.
npx motionsnack add range-inputCustomize
<RangeInput />Props
23 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | [number, number] | - | Controlled range. Leave undefined to let the component manage it. |
| defaultValue | [number, number] | [2000, 8000] | Range on first render when uncontrolled. |
| onChange | (value: [number, number]) => void | - | Called with [from, to] on every change. |
| onChangeEnd | (value: [number, number]) => void | - | Called with [from, to] when a drag or a key press on the slider ends. |
| duration | number | - | Deprecated: the slider glides with the standard 300ms. |
| name | string | - | Name of the form values; they go as <name>-from and <name>-to. |
| id | string | generated | Id of the first input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Budget' | Label above the fields. Empty hides it. |
| minLabel | string | 'From' | Small label inside the first field. |
| maxLabel | string | 'To' | Small label inside the second field. |
| min | number | 0 | Lowest value. |
| max | number | 20000 | Highest value. |
| step | number | 500 | Step of the slider and the smallest gap between the two values. |
| prefix | string | '€' | Text before each value, e.g. a currency sign. Empty hides it. |
| suffix | string | '' | Text after each value, e.g. kg. Empty hides it. |
| locale | string | 'en-US' | Locale of the thousands separator, e.g. en-US or cs-CZ. |
| showSlider | boolean | true | Show the two-thumb slider under the fields. |
| presets | string | 'Under 2k:0-2000, 2k-5k:2000-5000, 5k-10k:5000-10000, 10k+:10000-20000' | Quick ranges as chips, Label:from-to separated by commas. Empty hides them. |
| helperText | string | 'A rough range is enough. We will refine it together.' | Small text under the range. Empty hides it. |
| disabled | boolean | false | Disables the fields and the slider. |
| height | number | 48 | Height of a field (48, or 40 compact). |
| radius | number | 12 | Corner radius of a field. |
About Range Input
Range Input asks for a range instead of one number: a budget, a price band or a size. Two fields sit side by side with a small label, a currency or unit and thousands separators in the locale you choose. Under them a slider with two thumbs follows every keystroke and drives the fields when dragged, and the thumbs stop one step apart so they never cross. Preset chips glide the thumbs to a ready range and light up when it matches. If someone types the range the wrong way round, the two values swap with a short flip when the field loses focus. The fill and the active chip are black and white, and every field and thumb shows the library's clear focus outline.
What's included
- Two linked fields with prefix, suffix and locale formatting
- Two-thumb slider that never crosses
- Preset chips that glide the slider
- Swap with a flip for a reversed range
- Keyboard and screen reader friendly
- Hidden form values for from and to
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add range-input