
Range Slider React Component
Range Slider React component represents Range Slider component.
Range Slider Components
There are following components included:
**Range**/**F7Range**
Range Slider Properties
| Prop | Type | Default | Description |
|---|---|---|---|
| <Range> properties | |||
| --- | --- | --- | --- |
| init | boolean | true | Initializes Range Slider |
| value | number array string | Range Slider value, must be array in case of dual range slider | |
| min | number string | Minimum value | |
| max | number string | Maximum value | |
| step | number string | 1 | Maximum value |
| label | boolean | false | Enables additional label around range slider knob |
| dual | boolean | false | Enables dual range slider |
| draggableBar | boolean | true | When enabled it is also possible to interact with range slider (change value) on range bar click and swipe. |
| formatLabel | function(value) | Method must return formatted range knob label text. As an argument it receives label value | |
| disabled | boolean | false | Defines whether the range slider is disabled or not |
| id | string | Range slider element ID attribute | |
| input | boolean | false | If enabled, then it will render input type=”range” element inside as well |
| inputId | string | Input element ID attribute |
Range Slider Events
| Event | Description |
|---|---|
| <Range> events | |
| --- | --- |
| rangeChange | Event will be triggered when Range Slider value has been changed |
| rangeChanged | Event will be triggered on slider knob release after value change |
Range Slider Methods
| Event | Description |
|---|---|
| <Range> methods | |
| --- | --- |
| .setValue(newValue) | Set new range slider value |
| .getValue() | Returns range slider value |
Examples
1. export default class extends React.Component {
2. constructor(props) {
3. super(props);
5. this.state = {
6. priceMin: 200,
7. priceMax: 400,
8. }
9. }
10. render() {
11. return (
12. <Page>
13. <Navbar title="Range Slider"></Navbar>
15. <BlockTitle>Volume</BlockTitle>
16. <List simpleList>
17. <ListItem>
18. <ListItemCell className="width-auto flex-shrink-0">
19. <Icon ios="f7:volume_mute_fill" md="material:volume_mute"></Icon>
20. </ListItemCell>
21. <ListItemCell className="flex-shrink-3">
22. <Range
23. min={0}
24. max={100}
25. step={1}
26. value={10}
27. ></Range>
28. </ListItemCell>
29. <ListItemCell className="width-auto flex-shrink-0">
30. <Icon ios="f7:volume_fill" md="material:volume_up"></Icon>
31. </ListItemCell>
32. </ListItem>
33. </List>
35. <BlockTitle>Brightness</BlockTitle>
36. <List simpleList>
37. <ListItem>
38. <ListItemCell className="width-auto flex-shrink-0">
39. <Icon ios="f7:circle" md="material:brightness_low"></Icon>
40. </ListItemCell>
41. <ListItemCell className="flex-shrink-3">
42. <Range
43. min={0}
44. max={100}
45. step={1}
46. value={50}
47. label={true}
48. color="orange"
49. ></Range>
50. </ListItemCell>
51. <ListItemCell className="width-auto flex-shrink-0">
52. <Icon ios="f7:circle_half" md="material:brightness_high"></Icon>
53. </ListItemCell>
54. </ListItem>
55. </List>
57. <BlockTitle className="display-flex justify-content-space-between">Price Filter <span>${this.state.priceMin} - ${this.state.priceMax}</span></BlockTitle>
58. <List simpleList>
59. <ListItem>
60. <ListItemCell className="width-auto flex-shrink-0">
61. <Icon ios="f7:circle" md="material:brightness_low"></Icon>
62. </ListItemCell>
63. <ListItemCell className="flex-shrink-3">
64. <Range
65. min={0}
66. max={500}
67. step={1}
68. value={[this.state.priceMin, this.state.priceMax]}
69. label={true}
70. dual={true}
71. color="green"
72. onRangeChange={this.onPriceChange.bind(this)}
73. ></Range>
74. </ListItemCell>
75. <ListItemCell className="width-auto flex-shrink-0">
76. <Icon ios="f7:circle_half" md="material:brightness_high"></Icon>
77. </ListItemCell>
78. </ListItem>
79. </List>
80. </Page>
81. )
82. }
83. onPriceChange(values) {
84. this.setState({
85. priceMin: values[0],
86. priceMax: values[1],
87. });
88. }
89. }
