Skip to content
Liquidify
HomeDocsComponentsExamplesPlayground
⌘K
(opens in new tab)
Liquidify

Accessible React controls with a CSS and SVG material engine.

Product

ComponentsExamplesPlaygroundPackages

Learn

DocumentationGetting startedConceptsAI resources

Project

CommunityShowcaseVersionsGitHub

Independent open-source software. Not affiliated with or endorsed by Apple Inc.

LicenseBrand

Component catalog

Browse the public controls by interaction purpose. Every result links to generated API facts, accessibility behavior, source, and exhaustive stories.

Slider

A user-draggable control for choosing a single number within a bounded range — the canonical glass slider.

import { Slider } from "@liquidify/react/slider"

Overview

Basic Slider

A focused starting point showing Slider with its essential configuration.

API

PropTypeDefaultDescription
classNamestring | undefined—Optional additional CSS class merged into the glass surface class. The supported per-instance customisation seam: override any `--lq-*` custom property from this class's CSS — the token cascade the engine reads (ADR-0004). No raw inline style is involved, so this stays ADR-0003 clean.
defaultValuenumber | undefinedminUncontrolled seed for the internal value (ignored once {@link SliderProps.value} is supplied). Clamped into `[min, max]`.
disabledboolean | undefined—When `true`, the slider is dimmed (fill dimmed + thumb greyed), removed from the tab order (`tabIndex={-1}`), and all pointer / keyboard interaction is suppressed. Since the root is a `<div role="slider">` (no native `disabled`), this sets `aria-disabled` plus a `data-disabled` styling hook.
labelPropsLabelProps | undefined—Per-instance typography override for the bound labels, forwarded to the internal {@link Text} (ADR-0028). Token-backed axes only; the HIG default is `variant="footnote"` / `color="secondary"`. Applies only when a bound label is a string/number — an `<Icon>` / element bound passes through unwrapped.
maxnumber | undefined1Upper bound of the value range.
maxLabelReactNode—Trailing bound label for `variant="bounds"` — an `<Icon>` / `ReactNode` flanking the shortened track (the SwiftUI `maximumValueLabel` analogue). Decorative; it does not supply the accessible name.
minnumber | undefined0Lower bound of the value range.
minLabelReactNode—Leading bound label for `variant="bounds"` — an `<Icon>` / `ReactNode` flanking the shortened track (the SwiftUI `minimumValueLabel` analogue). Decorative; it does not supply the accessible name.
onChange((next: number) => void) | undefined—Fires with the next clamped/snapped number whenever the value moves — pointer jump, drag, or a keyboard step. Always called, in both controlled and uncontrolled modes.
onEditingChanged((editing: boolean) => void) | undefined—Fires `true` on press / drag start and `false` on release — the SwiftUI `onEditingChanged` analogue.
refRef<HTMLDivElement> | undefined—Forwarded ref to the rendered element — the component's native root (or the merged child element on a component that opts into {@link SlottableProps}). Generic over `E` (charter `docs/api-conventions.md` §4 rule 1, default `HTMLElement`) so a component with a polymorphic root (Link's navigation / action mode union, Text's `as`) can instantiate the concrete element per variant instead of leaving every consumer with a widened `Ref<HTMLElement>`. A component that does not narrow simply inherits the `HTMLElement` default — source-compatible with every pre-existing non-generic `extends ControlProps`.
stepnumber | undefined`0` (continuous)Snap increment. `0` is continuous (free movement); a positive value snaps the committed value to the nearest `min + round((raw - min) / step) * step` and drives the `stepped` keyboard increment.
tintLiquidTintValue | undefinedblueSystem-accent of the minimum-track fill (the SwiftUI `.tint(_:)` analogue), drawn from the restricted {@link LIQUID_COLORS } palette and applied via the `data-tint` attribute selector in CSS. Per Apple HIG the slider fill is system blue, so Slider defaults to `"blue"` (unlike Toggle's green).
valuenumber | undefined—Controlled value. Passing this switches Slider to controlled mode: the rendered value always reflects this prop (clamped into `[min, max]`) and the consumer owns it via {@link SliderProps.onChange}.
variantSliderVariant | undefinedplainThe init-form family of the slider ({@link SliderVariant}), resolved via the `data-variant` CSS selector.

Guidelines

Do
  • Use Slider when its semantics match the content or action.
  • Keep labels concise, specific, and consistent with the surrounding interface.
  • Test the component with keyboard navigation, zoom, and both color schemes.
Don't
  • Do not use Slider as a visual substitute for a different semantic element.
  • Do not rely on color or an icon alone to communicate essential meaning.
  • Do not override the component tokens with fixed values unless the product theme requires it.

Accessibility

Slider supports the documented keyboard interactions below.

Keyboard
  • Press Tab to move focus to the control.
  • Use the control's documented activation keys without trapping focus.
  • Provide an accessible name whenever the visible label is absent.

Tokens

NameValue
--lq-color-accent#007aff
--lq-color-action-secondaryrgba(120, 120, 128, 0.16)
--lq-color-bg-primary#ffffff
--lq-color-separatorrgba(60, 60, 67, 0.14)
--lq-color-system-blue-default-dark#0091ff
--lq-color-system-blue-default-light#0088ff
--lq-glass-440.71.15var(--lq-segmented-control-indicator-blur)calc(var(--lq-glass-material-blur) * 8)var(--lq-shadow-presentational)
--lq-hit-target-touch2.75rem
--lq-lens-progressResolved by the active Liquidify theme
--lq-lens-stretchResolved by the active Liquidify theme
--lq-lens-xResolved by the active Liquidify theme
--lq-radius-pill9999rem
--lq-shadow-ambient-0 0.125rem 0.375rem rgba(0, 0, 0, 0.10)0 0.5rem 1.375rem rgba(0, 0, 0, 0.20)0 0.75rem 1.75rem rgba(0, 0, 0, 0.14)
--lq-slider-bounds-gapvar(--lq-space-8)
--lq-slider-lens-clamp-glassyComponent-defined value
--lq-slider-lens-clamp-restComponent-defined value
--lq-slider-track-wcalc(var(--lq-space-64) * 3 + var(--lq-space-24))
--lq-space-0.0625rem0.125rem0.25rem0.5rem0.75rem1rem1.25rem1.5rem2rem2.5rem3rem3.5rem
--lq-thumb-calc(var(--lq-space-32) + var(--lq-space-2))var(--lq-space-56)var(--lq-space-40)
--lq-thumb-lens-hvar(--lq-space-40)
--lq-thumb-lens-wvar(--lq-space-56)
--lq-thumb-pill-hComponent-defined value
--lq-thumb-pill-wComponent-defined value
--lq-toggle-var(--lq-space-2)var(--lq-toggle-pad, var(--lq-space-2))0.55calc(var(--lq-space-64) + var(--lq-space-8))calc(var(--lq-space-40) + var(--lq-space-4))var(--lq-space-32)calc(var(--lq-space-16) + var(--lq-space-4))calc(var(--lq-toggle-track-h, var(--lq-space-32)) - 2 * var(--lq-toggle-pad, var(--lq-space-2)))var(--lq-space-24)var(--lq-thumb-lens-h)var(--lq-thumb-lens-w)calc( var(--lq-toggle-track-w, var(--lq-space-56)) - 2 * var(--lq-toggle-hpad, var(--lq-space-2)) - var(--lq-toggle-thumb-w, var(--lq-space-32)) )

Key features

  • Liquid material

    Uses Liquidify surfaces and theme-aware design tokens.

  • Typed API

    Provides a typed React API with generated prop documentation.

  • Accessible by default

    Preserves semantic structure, focus visibility, and assistive-technology state.

Resources

  • Source
  • Markdown
  • JSON
  • Storybook
Components