Slider
A slider for picking a value from a number range; with a label, the current value shows next to it.
zb:range zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Basic usage
Set the initial value with value and the unit with unit; the default range is 0–100.
<zb:range name="rate" label="Customer satisfaction target" :value="85" unit="%" />
| Prop | Values |
|---|---|
value | Initial value |
unit | Text appended to the value |
Range and step
min, max and step set the range and the increment; for a space before the unit write " km".
<zb:range name="radius" label="Search radius" :min="1" :max="50" :value="10" unit=" km" />
<zb:range name="budget" label="Campaign budget" :min="0" :max="5000" :step="250" :value="1500" unit=" ₺" />
| Prop | Values |
|---|---|
min | 0 |
max | 100 |
step | 1 |
Without a label
Without label the value is not shown either; name the slider with aria-label.
<zb:range name="volume" :value="40" aria-label="Notification volume" />
| Prop | Values |
|---|---|
aria-label | Invisible accessible name |
With Livewire
Bind it with wire:model and give the same value as value too, so the first render is right.
<zb:range wire:model.live="radius" label="Search radius" :min="1" :max="50" :value="$radius" unit=" km" />
| Prop | Values |
|---|---|
wire:model | The bound Livewire property |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
label | — | null | Label; if given, the value is shown next to it |
min | number | 0 | Minimum value |
max | number | 100 | Maximum value |
step | number | 1 | Increment |
value | — | null | Initial value; min when empty |
unit | — | '' | Unit appended to the value ("%", " km") |
hint | — | null | Help text below when there is no error; linked to the slider with aria-describedby |
input-class | — | null | Classes of the slider itself; class places the whole field |
Slots: class, style, x-show and wire:key go on the outer element that wraps the whole field; other attributes such as name, wire:model, disabled, aria-label and data-* are added to the slider. The field's validation error is shown below the slider.
Developer notes
- Bound with
wire:modelorx-model, the value in the label follows the model; when the server changes it (filling, resetting) the label updates too.