Skip to main content

Slider

A rolling pill-track tier slider and an elastic liquid range slider with over-drag and velocity tilt.

Good
Satisfied
04
Intensity64%

Customize

SizeMedium (md)
Liquid bulge (px)6
Rubber-band (px)14
Velocity tilt (deg)14
Spring speed1

Installation

Add the rolling pill-track slider or the elastic liquid slider with the registry command:

npx shadcn@latest add @kinetic/tier-slider
npx shadcn@latest add @kinetic/slider

Rolling tier rating

Use RollingTierRating for a five-tier experience rating slider with a rolling label, rolling caption, and numeric counter (01 through 05).

import { RollingTierRating } from "@/components/kinetic/ui/tier-slider";

export function ExperienceRating() {
  return <RollingTierRating defaultValue={3} aria-label="Experience rating" />;
}

Tier slider items

Use TierSlider with items to build a discrete stepped selector for plans, storage tiers, or quality presets. Enable showHeader and showLabels to display the rolling label and clickable step buttons.

"use client";

import { useState } from "react";
import { TierSlider, type TierSliderItem } from "@/components/kinetic/ui/tier-slider";

const STORAGE_TIERS: readonly TierSliderItem[] = [
  { label: "5 GB", caption: "Personal" },
  { label: "50 GB", caption: "Starter" },
  { label: "200 GB", caption: "Pro" },
  { label: "1 TB", caption: "Studio" },
];

export function StorageTierPicker() {
  const [tier, setTier] = useState(2);

  return (
    <TierSlider
      aria-label="Storage plan"
      items={STORAGE_TIERS}
      value={tier}
      onValueChange={setTier}
      showHeader
      showLabels
    />
  );
}

Continuous pill mode

Omit items on TierSlider for a continuous numeric pill slider with 1:1 pointer drag, internal ticks that fade around the active dot, and min, max, step, tickCount, and formatValue.

import { TierSlider } from "@/components/kinetic/ui/tier-slider";

export function ExportQualitySlider() {
  return (
    <TierSlider
      defaultValue={64}
      min={0}
      max={100}
      step={1}
      tickCount={7}
      formatValue={(value) => `${value}%`}
      aria-label="Export quality"
    />
  );
}

Elastic liquid usage

Import Slider from @/components/kinetic/ui/slider when you want single-value or multi-thumb range selection with a liquid track:

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

export function Volume() {
  return <Slider defaultValue={[50]} aria-label="Volume" />;
}

Range and step

Set min, max, and step on Slider. Values are arrays with one entry per thumb: pass two or more entries for a range slider, and thumbs cannot cross each other.

<Slider min={0} max={10} step={1} defaultValue={[5]} />

Controlled state

Pass value with onValueChange. Use onValueCommit on Slider to react when a drag ends or a key press changes the value. Pass name to submit values with a form.

const [value, setValue] = useState([40]);

<Slider value={value} onValueChange={setValue} aria-label="Volume" />

Value pill

On Slider, the value pill appears while a thumb is dragged or focused. Disable it with showTooltip={false} or format it with formatValue.

<Slider defaultValue={[60]} formatValue={(v) => `${v}%`} />
<Slider defaultValue={[60]} showTooltip={false} />

Elastic feel

Tune Slider physics with rubberBand (over-drag distance in pixels, capped at 32), liquidBulge (track bulge in pixels, capped at 14), and velocityTilt (pill tilt in degrees, capped at 30). Both TierSlider and Slider accept size as sm, md, or lg.

<Slider defaultValue={[30]} rubberBand={20} liquidBulge={10} velocityTilt={8} size="lg" />

Motion preferences

Spring transitions, elastic over-drag, liquid bulge, and tilt settle immediately when reduced motion is enabled, either in the browser or in the Kinetic setting. Time-based effects use the current tempo and the speed prop.

API Reference

TierSlider

Zero-dependency pill-track slider supporting discrete tier items with rolling vertical header and continuous numeric mode with 1:1 drag and auto-hiding ticks.

PropTypeDefaultDescription
itemsreadonly TierSliderItem[]-Optional tier items ({ label, shortLabel?, caption?, value? }). Providing 2+ items enables discrete mode; omitting switches to continuous numeric mode.
value / defaultValue / onValueChangenumber / number / (value: number) => void0 (discrete) / min (continuous)Controlled or initial tier index (discrete) or numeric value (continuous) and change callback.
min / max / stepnumber0 / 100 / 1Lower bound, upper bound, and step increment used in continuous numeric mode.
size / accent"sm" | "md" | "lg" / string"lg" / undefinedScales track height (32, 48, 64 px), dot size, and typography; accent overrides the active dot color when provided.
showHeader / showNumber / showLabelsbooleanfalse / true / trueShows the rolling label/caption header, displays the zero-padded step counter (01, 02, ... or item.value), and renders clickable step label buttons below the track.
tickCount / formatValuenumber / (value: number) => string7Tick count in continuous mode when step creates more than 10 intervals, and accessible aria-valuetext formatter.
speed / disabled / namenumber / boolean / string1 / falseTransition speed multiplier (0.25-4), disabled state, and native range input name.

RollingTierRating

Preset five-tier experience rating slider built on TierSlider with rolling header, accent dot, and step number counter enabled by default.

PropTypeDefaultDescription
defaultValue / accentnumber / string3 / "#FF5A1F"Initial 0-based rating index into the five default tiers and default highlight color for the active dot.
...propsTierSliderProps-Accepts all TierSlider props including custom items, size, showHeader, showNumber, showLabels, speed, and disabled.

Slider

Zero-dependency tactile range slider with organic liquid track swell, edge rubber-banding, click-to-jump spring, and velocity-tilted tooltip.

PropTypeDefaultDescription
value / defaultValuereadonly number[][50]Controlled or uncontrolled thumb values. Pass 1 value for single slider or 2+ values for a range slider.
onValueChange / onValueCommit(value: number[]) => void-Live callback fired while dragging or stepping, and commit callback fired on pointer release or keyboard commit.
min / max / stepnumber0 / 100 / 1Lower bound, upper bound, and quantization step.
size"sm" | "md" | "lg""md"Scales track thickness, thumb diameter, hit target height, and liquid bulge spread.
liquidBulgenumber6Maximum liquid swell amplitude (px) around the active thumb while dragging (0 disables).
rubberBandnumber14Maximum elastic over-drag displacement (px) when pulling past min or max edges (0 disables).
velocityTiltnumber14Maximum inertia tilt angle (deg) of the floating value pill based on drag velocity.
showTooltip / formatValueboolean / (value: number) => stringtrueControls visibility and text formatting of the floating value pill above the active thumb.
speed / disablednumber / boolean1 / falseSpring time scale multiplier (0.25-4) and disabled state.

Notes

Always pass number arrays such as [50] to value or defaultValue; passing a bare scalar falls back to two thumbs at [min, max]. Label the slider via aria-label or aria-labelledby.