A shadcn-style slider component built with Ark UI primitives.

Installation

npx shadcn@latest add @ark-cn/slider

Usage

import * as Slider from "@/components/ui/slider"

Read exported parts in src/components/ui/slider.tsx and compose the primitive according to the Ark UI pattern for this component.

Examples

Basic

Range

30 - 60

With marks

Min / max

Step

Events

onValueChange: -

onValueChangeEnd: -

Vertical

Vertical dragging indicator

Vertical two ranges

5-35 GB

0-100 GB

Two vertical range sliders (2 thumbs each) with different bounds.

Center origin

Offset from center20

Dragging indicator

Thumb overlap

Thumb collision behavior

Context

40

Thumb alignment

50
50

With field

Helper text (Field + Slider).

With number input

Disabled

Form

Read only

API reference

This component mirrors the upstream Ark UI primitive. All props and DOM behavior are defined by Ark unless you see an ark-cn-only row below.

Slider

PropTypeDescription
defaultValue?number | number[]Accepts scalar or array; normalized to Ark’s array form.
value?number | number[]Controlled value; accepts scalar or array.

SliderField

PropTypeDescription
trackProps?SliderTrackPropsForwarded to the track element.
rangeProps?SliderRangePropsForwarded to the range fill element.
thumbsProps?{ children?: (index: number) => ReactNode }Custom thumb contents per index.

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification.