Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Slider

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

Installation

npx logic2b@latest add slider

Usage

import { Slider } from "@/components/ui/slider"

<Slider defaultValue={[50]} max={100} step={1} />

API

Built on Radix Slider.Root. Values are always arrays, so a single-thumb slider uses [value] and a range uses [start, end].

Prop Type Default
defaultValue number[] [min, max]
value number[] — controlled value
onValueChange (value: number[]) => void
min number 0
max number 100
step number 1
orientation horizontal | vertical horizontal
disabled boolean false

Examples

Range

Controlled

40

Vertical

Accessibility

  • Each thumb is a slider role element that is fully keyboard operable.
  • Arrow keys move by step; Page Up / Page Down move by a larger increment; Home / End jump to min / max.
  • Associate a visible label with the control (e.g. via Label htmlFor or aria-label) so screen readers announce its purpose.
  • On range sliders each thumb is focusable independently and cannot cross past its neighbor.