Slider
A draggable control for selecting values from a continuous range.
<script lang="ts">
import { Slider } from "coss-svelte";
</script>
<Slider value={50} />
Installation
Install the component package, shared coss-svelte theme, and Bits UI peer.
npm install coss-svelte @coss-svelte/theme bits-uiUsage
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[]> }| Prop | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | "single" | Behavior, selection, or HTML type passed to the underlying control. |
bind:value | number | number[] | "" | Current value for the component. Bind with `bind:value` when supported. |
min | number | 0 | Minimum value for the control. |
max | number | 100 | Maximum value for the control. |
step | number | number[] | 1 | Increment used when changing slider values. |
children : Snippet<[SliderRootSnippetProps]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.Root.
SliderRange
Renders the filled range between slider values.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.Range.
SliderThumb
Renders the draggable or moving indicator.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.Thumb.
SliderThumbLabel
Labels the parent component or a grouped section.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.ThumbLabel.
SliderTick
Renders one slider tick mark.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.Tick.
SliderTickLabel
Labels the parent component or a grouped section.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Slider.TickLabel.
Implementation Details
- Status
- Stable
- Foundation
- bits
- Category
- Selection & Input
- Particles
- 23