sterling-svelte  2.0.0
A modern, accessible, lightweight UI component library for Svelte.

Slider

A value set by dragging a thumb between a minimum and maximum.

Code
<script lang="ts">
  import { Slider } from '@geoffcox/sterling-svelte';

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

<Slider bind:value />

Members

Property NameTypeDefaultComment
disabledboolean | null | undefinedfalseWhen true, the slider is disabled.
maxnumber | undefined100The maximum value of the slider.
minnumber | undefined0The minimum value of the slider.
stepnumber | undefined1The amount the value changes by pressing arrow keys.
onChange(value: number) => voidundefinedCalled when the value of the slider changes.
precisionnumber | undefinedundefinedThe number of decimal places to round the value
valuenumber | undefined0The current value of the slider.
verticalboolean | null | undefinedfalseWhen true, the slider is displayed vertically.

Considerations

  • Includes HTMLDivElement props, events, and methods.

Anatomy

slider (<div>)
  container (<div>)
    track (<div>)
    fill (<div>)
    thumb (<div>)