Skip to content

Slider #37

Closed
Closed

Description

@cixzhang

Spec

A slider for selecting numeric values from a continuous range. Supports single thumb and range (double thumb) via discriminated union on value type.

API

interface XDSSliderBaseProps {
  label: string;
  isLabelHidden?: boolean; // default false
  description?: string;
  isDisabled?: boolean; // default false
  isOptional?: boolean; // default false
  isRequired?: boolean; // default false
  status?: { type: "error" | "warning" | "success"; message?: string };
  labelTooltip?: string;
  min?: number; // default 0
  max?: number; // default 100
  step?: number; // default 1
  orientation?: "horizontal" | "vertical"; // default "horizontal"
  formatValue?: (value: number) => string;
  valueDisplay?: "tooltip" | "text" | "none"; // default "tooltip"
  marks?: Array<{ value: number; label?: string }>;
  xstyle?: StyleXStyles;
  "data-testid"?: string;
}

interface XDSSliderSingleProps extends XDSSliderBaseProps {
  value: number;
  onChange?: (value: number) => void;
  onChangeEnd?: (value: number) => void;
}

interface XDSSliderRangeProps extends XDSSliderBaseProps {
  value: [number, number];
  onChange?: (value: [number, number]) => void;
  onChangeEnd?: (value: [number, number]) => void;
  minStepsBetweenThumbs?: number;
}

type XDSSliderProps = XDSSliderSingleProps | XDSSliderRangeProps;

Design decisions

Decision Choice Rationale
Single component for single + range Discriminated union on value Dominant pattern (Radix, MUI, Ant). Less API surface for LLMs.
onChangeEnd not onChangeSettled onChangeEnd Most common name (React Aria, Mantine). Corpus-friendly.
No onTouched Dropped Form-framework concern. Consumers can use onChangeEnd.
isLabelHidden default false Fixed Internal defaulted to true for backward compat. Accessibility-first.
formatValue not getValueDisplayText Shorter name Clearer, less verbose.
min/max not minValue/maxValue min/max Corpus standard. Only React Aria uses minValue/maxValue.
marks support Added Common need. Supported by Mantine, MUI, Ant Design.
Unified status object { type, message? } Matches input family.

Research

  • Cross-system comparison: analyzed Radix, Ark, React Aria, Chakra, Mantine, MUI, Ant Design

Status: In Progress

PR

Activity

  1. added 2 commits that reference this issue on Feb 17, 2026
    0d305dd
    d4fbb80
  2. added a commit that references this issue on Apr 26, 2026
    2927c2e
  3. added a commit that references this issue on Jun 21, 2026
    bd434ed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions