Skip to content

Components

Slider

A value or a range chosen along a track, with optional ticks.

Customize
Ombelle · light

Installation

Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.

pnpm dlx @ombelle-ui/cli@1.1.2 add slider

Adds components/ui/slider.tsx and installs react, @radix-ui/react-slider, clsx, tailwind-merge with lifecycle scripts disabled. This is a client component.

In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.

Usage

example.tsx
import { Slider, SliderTicks } from '@/components/ui/slider'
export function Example(){return <div style={{ display: "grid", gap: "1rem" }}><Slider defaultValue={[12]} max={24} aria-label="Border radius" getValueText={value => value + ' pixels'} /><Slider defaultValue={[20, 80]} thumbLabels={['Minimum price', 'Maximum price']} /><SliderTicks values={[0, 25, 50, 75, 100]} /></div>}

API and states

API
Slider (value, defaultValue, min, max, step, orientation, thumbLabels, getValueText), SliderValue (format, editable), SliderTicks (values, min, max)
Minimum states
Single, range, disabled, vertical, focus
Native basis
Reviewed Radix Slider; Base UI Slider in the Base UI edition
Styles
Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.