Accessible two thumb input range component for React that implements <input type=range>
TwoThumbInputRange is a React component allowing users to input numeric values within a specific range.
Native HTML input type=range sliders do not support multiple thumbs yet so this component uses two range inputs and position them to look like a multi-thumb slider.
Under the hood TwoThumbInputRange uses HTML input type=range, but uses CSS Magic to allows users to adjust with 2 buttons
- [x] Multi-Touch support
- [x] Accessible with ARIA and keyboard support
- [x] Highly Customizable
- [x] Written in TypeScript
All examples available in Storybook
``sh
yarn add react-two-thumb-input-range
npm i react-two-thumb-input-range
`
`js`
import { TwoThumbInputRange } from "react-two-thumb-input-range"
`jsx
function App() {
const [value, setValue] = useState([1000, 4333])
const onValueSChange = (values) => {
setValue(values)
}
return
}
`
| Attribute | Type | Default | Description |
| :-------------- | :-------------------: | :-------: | :--------------------------------------------------------------------------------------------------------------------------------- |
| min | number | 0 | The minimum permitted value. |number
| max | | 100 | The maximum permitted value. |[number,number]
| values | | | The current value of the Input Range. |func
| onChange | | | Callback function that is fired when the Input's value changed. onChange: ([number, number]) => void |string
| railColor | | #EDF2F7 | Color of rail element. |string
| trackColor | | #1976d2 | Color of track element. |string
| thumbColor | | #EDF2F7 | Color of thumb element. |React.CSSProperties
| thumbStyle | | 1976d2 | Styles applied to the thumb element |React.CSSProperties
| thumbFocusStyle | | | Styles applied to the when thumb element focus |React.CSSProperties
| inputStyle | | | Styles applied to the input element |React.CSSProperties
| labelStyle | | | Styles applied to the label element |React.CSSProperties
| labelTextStyle | | | Styles applied to the label textelement |boolean
| showLabels | | true | If false, the default labels will not render. |string` | | MDN Web Docs |
| ariaValueText |