sterling-svelte  2.0.23
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 NameTypeBindableDefaultComment
disabledboolean | null | undefinednofalseWhen true, the slider is disabled.
maxnumber | undefinedno100The maximum value of the slider.
minnumber | undefinedno0The minimum value of the slider.
onChange(value: number) => voidnoundefinedCalled when the value of the slider changes.
precisionnumber | undefinednoundefinedThe number of decimal places to round the value.
reverseboolean | null | undefinednofalseWhen true, the slider direction from min to max is reversed.
stepnumber | undefinedno1The amount the value changes by pressing arrow keys.
valuenumber | undefinedno0The current value of the slider.
verticalboolean | null | undefinednofalseWhen true, the slider is displayed vertically.

Considerations

  • Includes HTMLDivElement props, events, and methods.

Anatomy

<div class="sterling-slider>
  <div class="container">
    <div class="track"></div>
    <div class="fill"></div>
    <div class="thumb"></div>
  </div>
</div>