Skip to content

@vibe-labs/design-components-sliders

Slider, range, and track component tokens, styles, and TypeScript types for the Vibe Design System.

Usage

css
@import "@vibe-labs/design-components-sliders";
ts
import { SliderSizes, SliderThumbShapes, SliderTrackColors } from "@vibe-labs/design-components-sliders/types";
import type { SliderStyleProps, SliderThumbStyleProps } from "@vibe-labs/design-components-sliders/types";

Contents

Tokens (sliders.css)

Component-specific tokens defined in @layer vibe.tokens. Focus ring tokens (--ring-*) are owned by @vibe-labs/design-elevation. Disabled opacity inherits from @vibe-labs/design-forms.

Track

TokenDefaultDescription
--slider-track-height-{sm|md|lg}2px / 4px / 6pxTrack thickness
--slider-track-radius--radius-fullTrack border radius
--slider-track-bg--surface-overlayUnfilled track background
--slider-track-fill--color-accentFill color
--slider-track-fill-hover--color-accent-hoverFill color on hover
--slider-track-border-width0Optional track border
--slider-track-border-color--border-subtleTrack border color

Thumb — Circle (default)

TokenDefaultDescription
--slider-thumb-size-{sm|md|lg}0.75rem / 1rem / 1.25remThumb diameter
--slider-thumb-bg--color-neutral-0Thumb background
--slider-thumb-border-width2pxThumb border
--slider-thumb-border-color--color-accentThumb border color
--slider-thumb-shadow--shadow-smRest shadow
--slider-thumb-shadow-active--shadow-mdActive/dragging shadow
--slider-thumb-scale-hover1.15Hover scale factor
--slider-thumb-scale-active1.25Active scale factor
--slider-thumb-transition--duration-fastTransition speed

Thumb — Bar Variant

TokenDefaultDescription
--slider-bar-width-{sm|md|lg}2px / 3px / 4pxBar width
--slider-bar-height-{sm|md|lg}0.875rem / 1.125rem / 1.375remBar height
--slider-bar-radius--radius-fullBar end caps

Marks

TokenDefaultDescription
--slider-mark-size4pxMark dot diameter
--slider-mark-color--surface-overlayInactive mark color
--slider-mark-color-active--color-accentActive mark color
--slider-mark-label-font-size--text-xsLabel font size
--slider-mark-label-color--text-mutedLabel text color
--slider-mark-label-gap--space-2Gap between track and label

Tooltip

TokenDefaultDescription
--slider-tooltip-bg--surface-elevatedBackground
--slider-tooltip-color--text-primaryText color
--slider-tooltip-font-size--text-xsFont size
--slider-tooltip-font-weight--font-semiboldFont weight
--slider-tooltip-px--space-2Horizontal padding
--slider-tooltip-py--space-1Vertical padding
--slider-tooltip-radius--radius-mdBorder radius
--slider-tooltip-shadow--shadow-mdShadow
--slider-tooltip-offset--space-2Distance from thumb

Generated Styles (sliders.g.css)

Container

  • slider — relative flex container with touch-action: none, cursor: pointer
  • Sizes: sm · md · lg (default: md) — controls track height + thumb size
  • Orientation: horizontal (default) · vertical
  • Disabled: reduced opacity, pointer-events: none
  • Flags: range (dual-thumb), tooltip mode (none | hover | always)

Track

  • slider-track — full-width rounded container
  • slider-track-fill — left-anchored fill, width via --slider-fill custom property
  • Range mode: fill positioned via --slider-fill-start and --slider-fill-end
  • Color variants: accent · success · warning · danger

Thumb

  • slider-thumb — absolute positioned, circle by default, grab cursor
  • Shapes: circle (default) · bar · pill · none
  • States: hover (scale up), active (scale + shadow), focus-visible (ring)
  • Vertical: axis-swapped positioning

Marks

  • slider-marks — absolute container, pointer-events: none
  • slider-mark — small dot at step position, active state for marks below value
  • slider-mark-label — positioned text below (or beside for vertical)

Tooltip

  • slider-tooltip — positioned above thumb, hidden by default
  • Modes: none (default) · hover (show on hover/drag) · always (permanently visible)

Native Input

  • slider-input — sr-only (visually hidden, keyboard accessible)

TypeScript Types (types/)

ts
SliderSizes; // ["sm", "md", "lg"]
SliderThumbShapes; // ["circle", "bar", "pill", "none"]
SliderTrackColors; // ["accent", "success", "warning", "danger"]
SliderTooltipModes; // ["none", "hover", "always"]
SliderOrientations; // ["horizontal", "vertical"]

interface SliderStyleProps {
  size?: SliderSize;
  orientation?: SliderOrientation;
  disabled?: boolean;
  tooltip?: SliderTooltipMode;
  range?: boolean;
}
interface SliderTrackStyleProps {}
interface SliderTrackFillStyleProps {
  color?: SliderTrackColor;
}
interface SliderThumbStyleProps {
  shape?: SliderThumbShape;
  active?: boolean;
}
interface SliderMarkStyleProps {
  active?: boolean;
}
interface SliderMarkLabelStyleProps {}
interface SliderTooltipStyleProps {
  visible?: boolean;
}

Dist Structure

FileDescription
index.cssBarrel — imports all files below
sliders.cssToken definitions
sliders.g.cssGenerated slider styles
index.js / index.d.tsTypeScript types + runtime constants

Dependencies

Requires @vibe-labs/design (colors, surfaces, spacing, typography, transitions, elevation) and @vibe-labs/design-forms (disabled opacity).

Build

bash
npm run build