Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-slider.json --yes

Slider

Pro

A value or a span chosen by dragging a thumb along a track or with the arrow keys, such as a volume or a price limit, for React and Tailwind CSS. Part of Goop Pro.

Drag the thumb or use the arrows, PageUp/PageDown, Home and End; switch to a range, change the step and the format, add ticks, an icon or a header label, disable it. The value, moving and settled, is only written under it.

When to use

  • A value or a span chosen by dragging a thumb along a track or with the arrow keys, such as a volume or a price limit.
  • Also called: range input.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Slider on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-slider.json --yes
PROMPT
Add the Goop Slider to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Slider } from '@/components/ui/goop/slider';

<>
  <Slider defaultValue={40} min={0} max={100} step={5} icon="volume" aria-label="Volume" onValueCommit={send} />
  <Slider
    range
    label="Price"
    defaultValue={[20, 80]}
    format={(value) => `$${value}`}
    preview={([low, high]) => `${Math.round(((high - low) / 100) * 32)} of 32 items in this range`}
  />
</>
  • Fits: settings (its recipe).
  • height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

API reference

  • Each option with its sentence: slider--options.md
  • State: value (value / defaultValue / onValueChange); drawn by data-disabled
  • data-slot values (to select a part by): slider, slider-bubble, slider-field, slider-header, slider-icon, slider-knob, slider-label, slider-preview, slider-range, slider-thumb, slider-thumbs, slider-tick, slider-tick-label, slider-tick-labels, slider-ticks, slider-track, slider-value

Slider: every option

TSX
import { Slider } from '@/components/ui/goop/slider';

Options

  • range?: false | true — Two thumbs instead of one: the value is [low, high].
  • value?: number | readonly [number, number] — The value, controlled, from min to max. Or: The values, controlled: [low, high].
  • defaultValue?: number | readonly [number, number] — The value at first, uncontrolled (default min). Or: The values at first, uncontrolled (default [min, max]).
  • onValueChange?: ((value: number) => void) | ((value: [number, number]) => void) — Called with the new number on every change (a key, a drag's move, a press on the track). Or: Called with [low, high] on every change.
  • onValueCommit?: ((value: number) => void) | ((value: [number, number]) => void) — Called with the number a person settled on: a drag released, or a key. Or: Called with the [low, high] a person settled on.
  • preview?: ((value: number) => ReactNode) | ((value: readonly [number, number]) => ReactNode) — A line under the track: the caller's words for the value, such as "22 of 32 items". Or: A line under the track: the caller's words for the span.
  • id?: string — The root's id.
  • ref?: Ref<HTMLSpanElement> — The root element (the press target).
  • className?: string — Classes for the outermost element, last: a width, a margin.
  • min?: number = 0 — The lowest value.
  • max?: number = 100 — The highest value.
  • step?: number = 1 — The distance one arrow key moves a value; a press or a drag snaps to it.
  • name?: string — The name the value is sent under in a form.
  • form?: string — The id of the form the value is sent with, where the slider sits outside it.
  • disabled?: boolean — Off: nothing moves it, no thumb is a tab stop, and it is dimmed.
  • format?: (value: number) => string — How a value reads in the bubble, the header and to a reader ("60%", "$7,400"); grouped digits by default.
  • label?: ReactNode — A header row over the track, the label at its start and the value at its end, naming the thumb.
  • ticks?: ReadonlyArray<number | SliderTick> — Marks on the track at these values; one with a label adds the labels row under it.
  • icon?: IconName — A pack icon name before the track, hidden from a reader ("volume").
  • aria-label?: string — The thumb's accessible name.
  • aria-labelledby?: string — The id of the element that names the thumb.
  • aria-describedby?: string — The ids of the elements that describe the thumb (a Field's description).
  • aria-valuetext?: string — The value in words where the number says too little ("40 percent"); format's by default.
  • Also takes: dir?: 'ltr' | 'rtl'
  • State: value (value / defaultValue / onValueChange); drawn by data-disabled
  • Types: SliderTick = { value: number; label?: ReactNode }

Keyboard

KeyWhat it does
ArrowRight ArrowUpRaise the value by one step (in a range, never past the other thumb; the focus stays)
ArrowLeft ArrowDownLower the value by one step (in a range, never past the other thumb; the focus stays)
PageUp PageDownRaise or lower the value by ten steps (in a range, never past the other thumb; the focus stays)
HomeSet the focused thumb's lowest value (in a range the high thumb stops at the low one), the focus staying
EndSet the focused thumb's highest value (in a range the low thumb stops at the high one), the focus staying

Accessibility

  • The behaviour layer under the part answers keys, focus and dismissal: never write your own.
  • hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
disabledthe attribute data-disabled

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/trail/components/slider.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-slider.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.