Vue RangeSlider - Overview
The RangeSlider is a UI component that allows an end user to choose a range of numeric values. Basically, the RangeSlider is the Slider UI component with a second handle added.
The following code adds a simple RangeSlider to your page. The start and end properties specify the selected interval. The min and max properties limit the range of accepted values.
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import { RangeSlider } from 'devextreme-react/range-slider';
- class App extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- startValue: 20,
- endValue: 60
- };
- this.handleValueChange = this.handleValueChange.bind(this);
- }
- handleValueChange(e) {
- const newStartValue = e.start;
- const newEndValue = e.end;
- // Event handling commands go here
- this.setState({
- startValue: newStartValue,
- endValue: newEndValue
- });
- }
- render() {
- return (
- <RangeSlider
- min={0}
- max={100}
- start={this.state.startValue}
- end={this.state.endValue}
- onValueChanged={this.handleValueChange}
- />
- );
- }
- }
- export default App;
In addition, you can specify the step of RangeSlider values using the step property.
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import { RangeSlider } from 'devextreme-react/range-slider';
- class App extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- startValue: 20,
- endValue: 60
- };
- this.handleValueChange = this.handleValueChange.bind(this);
- }
- handleValueChange(e) {
- const newStartValue = e.start;
- const newEndValue = e.end;
- // Event handling commands go here
- this.setState({
- startValue: newStartValue,
- endValue: newEndValue
- });
- }
- render() {
- return (
- <RangeSlider
- min={0}
- max={100}
- step={10}
- start={this.state.startValue}
- end={this.state.endValue}
- onValueChanged={this.handleValueChange}
- />
- );
- }
- }
- export default App;
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.