Skip to content

Slider

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

API Reference

Installation

pnpm dlx shadcn@latest add @frontal-labs/slider

Usage

import { Slider, SliderValue } from "@/components/ui/slider";
<Slider />

API Reference

Slider

Root component. Styled wrapper for Slider.Root from Base UI with default min/max values and edge-aligned thumbs.

Note: The component sets thumbAlignment="edge" by default, which aligns thumbs to the edge of the track rather than centering them.

Haptics use the useHaptics hook, so they no-op when the device lacks the Vibration API, when the user prefers reduced motion, or when haptics are turned off via setEnabled. Programmatic and form-driven value changes never vibrate.

SliderValue

Displays the current value. Styled wrapper for Slider.Value from Base UI.

Examples

For accessible labelling and validation, prefer using the Field component to wrap checkboxes. See the related example: Slider field.

With Label and Value

Component p-slider-2 not found in registry.

Range Slider

Vertical

Form Integration

Haptic Feedback

Pass haptic to vibrate on each step and on pointer release. Best felt on a phone; desktop browsers and reduced-motion users get a silent no-op.