Slider

A draggable control for selecting values from a continuous range.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { Slider, SliderRange, SliderThumb, SliderThumbLabel, SliderTick, SliderTickLabel } from "coss-svelte";

Anatomy

  • Slider
  • SliderRange
  • SliderThumb
  • SliderThumbLabel
  • SliderTick
  • SliderTickLabel

API Reference

Slider

A draggable control for selecting values from a continuous range.

Signatures

{ type?: "single"; value?: number; onValueChange?: OnChangeFn<number>; onValueCommit?: OnChangeFn<number> }{ type: "multiple"; value?: number[]; onValueChange?: OnChangeFn<number[]>; onValueCommit?: OnChangeFn<number[]> }
PropTypeDefaultDescription
type"single" | "multiple""single"Behavior, selection, or HTML type passed to the underlying control.
bind:valuenumber | number[]""Current value for the component. Bind with `bind:value` when supported.
minnumber0Minimum value for the control.
maxnumber100Maximum value for the control.
stepnumber | number[]1Increment used when changing slider values.
children : Snippet<[SliderRootSnippetProps]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.Root.

SliderRange

Renders the filled range between slider values.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.Range.

SliderThumb

Renders the draggable or moving indicator.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.Thumb.

SliderThumbLabel

Labels the parent component or a grouped section.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.ThumbLabel.

SliderTick

Renders one slider tick mark.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.Tick.

SliderTickLabel

Labels the parent component or a grouped section.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Slider.TickLabel.

Implementation Details

Status
Stable
Foundation
bits
Category
Selection & Input
Particles
23