The QRange component is a great way to offer the user the selection of a sub-range of values between a minimum and maximum value, with optional steps to select those values. An example use case for the Range component would be to offer a price range selection.
Also check out its “sibling”, the QSlider component.
Usage
Notice we are using an object for the selection, which holds values for both the lower value of the selected range - rangeValues.min
and the higher value - rangeValues.max
.
Standard
WARNING
You are responsible for accommodating the space around QRange so that the label and marker labels won’t overlap the other content on your page. You can use CSS margin or padding for this purpose.
Vertical
With inner min/max v2.4+
Sometimes you need to restrict the model value to an interval inside of the track’s length. For this purpose, use inner-min
and inner-max
props. First prop needs to be higher or equal to min
prop while the latter needs to be lower or equal to the max
prop.
With step
The step
property can also be a floating point number (or numeric 0
if you need infinite precision).
With label
In the example below, move the slider to see the label.
The example below is better highlighting how QRange handles label positioning so that it always stays inside the QRange’s box horizontally.
Markers
Marker labels v2.4+
TIP on slots
In order to use the marker label slots (see below), you must enable them by using the marker-labels
prop.
Other customizations v2.4+
Dragging range
Use the drag-range
or drag-only-range
props to allow the user to move the selected range or only a predetermined range as a whole.
Lazy input
Null values
Reverse
Force dark mode
Readonly and disable
With QItem
Native form submit
When dealing with a native form which has an action
and a method
(eg. when using Quasar with ASP.NET controllers), you need to specify the name
property on QRange, otherwise formData will not contain it (if it should):