Forms

Slider

A range input for picking a number by dragging: volume, a price limit, a rating. It has the field layout (label, help, error), a filled track up to the thumb, the current value next to the label, and optional tick marks that can be clicked.

Volume: 30
Blade

A "Volume" label with "30" at its end, over a track filled up to the thumb at 30%. Dragging the thumb, or the arrow keys, moves it in steps of 10; the number and the fill follow, and $volume receives the value.

Tick marks #

The five labels spread under the track; clicking one moves the thumb to its value. Each tick sits at its value along the track (:ticks="[0, 10, 100]" puts the 10 near the start); when any tick has no number (no value and a label that is not a number), all of them are spread evenly. :ticks="[0, 50, 100]" shows the numbers themselves, and a tick without a label is drawn as a small mark.

XS

S

M

L

XL

Blade

Icons around the track #

A dim sun before the track and a bright one after it.

Blade

Colors, sizes and states #

color fills the track and size scales it; disabled and readonly lock the thumb.

Blade

Price filter #

A slider driving a filter: the label shows the limit with show-value, and the summary below follows the bound property.

0

250

500

750

1000

Showing products up to $250
Blade

Ticks written by hand #

tk:slider.tick tags in the slot take a value and any content, here icons for a rating.

Blade

Customization #

Classes go to the box; prefixed attributes reach the value (value:), the row of ticks (ticks:) and each tick (tick:).

10

15

20

25

30

Blade

Reference

tk:slider
└── tk:slider.tick ...

tk:slider

Prop Type Default Description
showValue bool false Shows the current value at the end of the label line.
ticks array null Marks under the track: numbers, or arrays of tk:slider.tick props (label, value).

min, max and step are the native attributes (0, 100 and 1 by default). Also accepts the field props (label, help, value, size, color...) and the field control props (icon, iconTrailing, prepend, append). prefix and suffix are not shown. color also fills the track (accent or a palette color). wire:model and x-model bind the number.

Slots

Slot Description
default tk:slider.tick elements, after those from ticks.

Prefixes

Prefix Goes to
slider: The element around the track and the ticks.
ticks:, tick: The row of ticks; each tick from ticks.
value: The value shown with showValue.

tk:slider.tick

Prop Type Default Description
value number from the label The value the thumb moves to when the tick is clicked. Without it, the label is read as a number.
label string | slot null The text under the track. Without it, a small mark.
size string md The text size. The slider passes its own to the ticks from ticks; a tick written by hand takes it here.

Also accepts the element props.

Slots

Slot Description
default The tick content, in place of label.

Customization

Classes on the tag go to the box around the track and its icons (a class alone is enough to render that box), never to the <input type="range">; other attributes go to the input. Besides the prefixes of the field props (listed in the Reference above).

blade

Accessibility

A native <input type="range"> with its label, so screen readers announce the value and keyboard users move it with the arrow keys, Home, End, Page Up and Page Down. The value shown next to the label is hidden from screen readers, which already announce it. readonly blocks the keys and the pointer and sets aria-readonly. When the value matches a tick with a label, that label is its aria-valuetext ("M" instead of "2").

Behavior notes

  • The fill and the shown value follow the input as it is dragged, when a Livewire update changes the bound property, and when the form is reset.
  • Inside a Livewire component, value is ignored: the bound property is the value.