Slider

An input where the value is within a set range.

Preview
Code

Basic Example

<script lang="ts">
	import { Slider, SliderRange, SliderThumb } from 'lithesome';

	let value = $state(20);
</script>

<Slider bind:value>
	<SliderRange />
	<SliderThumb />
</Slider>

API Reference

<Slider />

PropertyTypeDescription
value number

The current value.

min number

The minimum value.

max number

The maximum value.

step number

The steps between the `min` and `max` props.

orientation 'horizontal' | 'vertical'

The direction in which the slider will be used.

reverse boolean

Reverse the logic of the `orientation`.

disabled boolean

Disables the entire group, stops all events from firing.

ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
valuenumberThe current value.
percentagenumberThe current percentage from 0 to 100.

<SliderThumb />

PropertyTypeDescription
ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
valuenumberThe current value.
percentagenumberThe current percentage from 0 to 100.

<SliderRange />

PropertyTypeDescription
ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
valuenumberThe current value.
percentagenumberThe current percentage from 0 to 100.

<SliderValue />

PropertyTypeDescription
ref E

The reference to the underlying element.