Slider

Pick a number, or a range, by dragging along a track: a depth window, a threshold, a layer’s opacity.

One value

70 %
<Field label="Layer opacity">
	<Slider bind:value={opacity} format={(v) => `${v} %`} showValue />
</Field>

<Field label="Depth window">
	<Slider bind:value={depth} max={50} format={(v) => `${v} m`} showRange />
</Field>

A range

Two thumbs, with the scale’s ends under the track.

0 m50 m

5 to 30 m

Steps and marks

Dots for each step, and labels under the points that matter. The thumb snaps between the dots.

Calm Moderate Very rough

Missions are called off above slight.

0 0,5 1 0,4
<Slider bind:value={seaState} max={5} ticks
	marks={[{ value: 0, label: 'Calm' }, { value: 3, label: 'Moderate' }, { value: 5, label: 'Very rough' }]} />

<Slider bind:value={share} max={1} step={0.1} ticks
	marks={[{ value: 0 }, { value: 0.5 }, { value: 1 }]} format={nb} />

Disabled

Rules

  • Dots for a scale of a few steps, up to about 20. A percentage or a depth in metres needs none.
  • Marks name the points people steer by: the ends and a middle, not every step.
  • For feeling out a value and watching the result move. A number someone knows goes in a Number field.
  • Show the value: above the thumb while it matters, or in the label.
  • Format for people: "30 m", not "30". The format is read out to screen readers too.
  • Two thumbs for a range. Never two sliders for its ends.