VDS

Slider

An input where the user selects a value from within a given range.

Installation

pnpm install @vds-testing/react @vds-testing/styles
pnpm install @vds-testing/elements @vds-testing/styles

See Installation for CSS setup.

Usage

React:

import { Slider } from "@vds-testing/react"
<Slider defaultValue={[33]} max={100} step={1} />

Web Components:

<script type="module">
  import "@vds-testing/elements";
</script>
<vds-slider default-value="[33]" max="100" step="1"></vds-slider>

Examples

Range

Multiple thumbs

Step values

Vertical

Disabled

With label

50%

Anatomy

  • Slider - The main slider container with track, range, and thumb(s)

Props

Prop Type Default Description
defaultValue number[] [0] Initial value(s). Use multiple values for a range slider
value number[] - Controlled value(s) (React)
onValueChange (values: number[]) => void - Called when value(s) change (React)
min number 0 Minimum value
max number 100 Maximum value
step number 1 Step increment
disabled boolean false Disables the slider
orientation “horizontal” | “vertical” “horizontal” Slider orientation
name string - Form input name
class / className string - Additional CSS classes

Web Components use kebab-case attributes (default-value='[33]', orientation, disabled).