Reference

Slider

Range input. aria-* and its other attributes reach the input; with aria-valuetext the raw number is not shown beside the track.

Slider(bind: State, min: Number, max: Number, …)

Before 5.0

min

max

step

range

label

disabled

Volume: 60%

Example

wf

state volume = 60 Slider(bind: volume, min: 0, max: 100, step: 5, label: "Volume") Text("Volume: {volume}%").muted

A range, with two thumbs

wf

state price: [Number] = [20, 80] Slider(bind: price, min: 0, max: 200, step: 10, label: "Price").range Text("From ${price[0] ?? 0} to ${price[1] ?? 0}")

Disabled

wf

state brightness = 40 Slider(bind: brightness, min: 0, max: 100, label: "Brightness").disabled

Props

Props of Slider
PropTypeUnsetMeaning

bind:

State

The Number state it reads and writes as it is dragged; with .range a [Number] holding [low, high]. Its value is shown beside the track

min:

Number

0

The value at the start of the track

max:

Number

100

The value at the end of the track

step:

Number

1

How far one move of the thumb, or one arrow key, changes the value

range:

Bool

false

Two thumbs, a low and a high that cannot pass each other: bind: holds [low, high], read as [min, max] until it holds two numbers. Written as a flag, .range, or range: true.

label:

String

none (Range with .range)

The label drawn above the track and the input's accessible name; with .range no label is drawn, and it names the group and each thumb (Price, lowest)

disabled:

Bool

false

Whether the control is inert: it cannot be focused or changed, and a form does not send it. Written as a flag, .disabled, or disabled: true.

Attribute families: global, aria, data, input. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.range

.disabled

Events

The DOM events it is drawn to answer. Any other DOM event works too, in an on … { } handler.

DOM events Slider answers
EventSendsMeaning
on inputDOMThe value changed, on every keystroke
on changeDOMThe value was committed

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Renders with the class wf-slider, stable across releases, so a stylesheet may target it.