skip section navigation

Slider

choose a numeric value by moving the range or using its keyboard controls. add ticks for meaningful destinations, or a numeric editor when someone already knows the value.

daily reading goal

20 minutes

usage

svelte
<script lang="ts">
	import { Slider } from '@ciabi/loafkit-ui';
	let minutes = $state(20);
</script>

<Slider label="daily reading goal" name="minutes" min={5} max={60} step={5} bind:value={minutes} />
<p role="status">{minutes} minutes</p>

use a visible label and units that fit the task. the range input submits its value under name; your app still owns the form and its saved result.

tick destinations and a numeric editor

reading session minutes

session: 20 minutes

svelte
<script lang="ts">
	import { Slider } from '@ciabi/loafkit-ui';
	let sessionMinutes = $state(20);
</script>

<Slider label="reading session minutes" variant="bulky" min={5} max={60} step={5}
	showInput bind:value={sessionMinutes} ticks={[{value:5,label:'quick note'},{value:20,label:'one article'},{value:60,label:'a free hour'}]} />
<p role="status">session: {sessionMinutes} minutes</p>

API reference

Tick describes the local object shape, not a separately exported type. native input attributes other than type/value/min/max/step are forwarded to the range; class/style affect the wrapper.

Slider

Component
value
Default: 0

the bindable numeric value.

min
Default: 0

the start of the range.

max
Default: 1

the end of the range; must exceed min.

step
Default: 'any'

the value increment for native keyboard and numeric commits.

ticks
Default: []

visible destinations selected by the nearest pointer position.

variant
Default: 'default'

the track presentation.

label

visible heading and range accessible name.

showInput
Default: false

shows a numeric editor alongside the label.

background

custom track background; makes the progress background transparent.

class
Default: ''

extra classes on the slider wrapper.

style

inline styles on the slider wrapper.

Tick

Type

one tick supplied to Slider; this local shape is not a package export.

value

the destination value, inside the range.

label

tick button accessible name and tooltip; otherwise the numeric value names it.