v0.0.2
Demos (demo panel, opens in a new tab)

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

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Basic usage

Basic usage: view
BLADE

Set the initial value with value and the unit with unit; the default range is 0–100.

blade
<zb:range name="rate" label="Customer satisfaction target" :value="85" unit="%" />
PropValues
valueInitial value
unitText appended to the value

Range and step

Range and step: view
BLADE

min, max and step set the range and the increment; for a space before the unit write " km".

blade
<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=" ₺" />
PropValues
min0
max100
step1

Without a label

Without a label: view
BLADE

Without label the value is not shown either; name the slider with aria-label.

blade
<zb:range name="volume" :value="40" aria-label="Notification volume" />
PropValues
aria-labelInvisible accessible name

With Livewire

BLADE

Bind it with wire:model and give the same value as value too, so the first render is right.

blade
<zb:range wire:model.live="radius" label="Search radius" :min="1" :max="50" :value="$radius" unit=" km" />
PropValues
wire:modelThe bound Livewire property

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label—nullLabel; if given, the value is shown next to it
minnumber0Minimum value
maxnumber100Maximum value
stepnumber1Increment
value—nullInitial value; min when empty
unit—''Unit appended to the value ("%", " km")
hint—nullHelp text below when there is no error; linked to the slider with aria-describedby
input-class—nullClasses 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

Events, hooks and details
  • Bound with wire:model or x-model, the value in the label follows the model; when the server changes it (filling, resetting) the label updates too.
Zubazar UI · ZubazarDesigned for people.