import * as React from 'react'import { RangeType, Slider } from '@welcome-ui/slider'const Example = () => {const handleChange = (value: number) => {alert(value)}const handleChangeRange = (value: RangeType) => {alert(`${value.min} to ${value.max}`)}return (<><Slider max={100} min={0} onChange={handleChange} value={50} /><Slider.Range max={100} min={0} onChange={handleChangeRange} value={{ min: 25, max: 75 }} /></>)}export default Example
Installation
Run the following command:
yarn add @welcome-ui/slider
Import component:
import { Slider } from '@welcome-ui/slider'
Add w
and h
to set size of shape.
Label & Hint
label
and hint
props to add some information to your slider.
Step
step
prop allow you to snap to predefined sets of values.
Tooltip
tooltip
prop to indicate the value being selected when dragging.
Disabled
disabled
prop to indicate the value being selected when dragging.
Types
Slider
There is 3 differents types for slider: inline
, left-field
and right-field
.
Range Slider
There is only 2 differents types for range slider: inline
and fields
.
Values
You can specify a range of values that will add a mark for each of them.
borderSelectorColor
To match your background color, you should add a borderSelectorColor
.