Slider v2

Alpha. A thick track with a white thumb and optional step dots.

Slider v2 is in alpha. Its props and motion may still change before it replaces Slider.

Playground

Open Show controls to switch the mode, size, variant and step count.

Dots

A dot on every step. The value snaps to the dots, and the thumb holds a little on each one as you drag past it.

Continuous

No dots. The thumb follows the pointer exactly.

Marks

A dot at a value worth landing on, such as the default. A dragged thumb catches on it.

Small

A 20px track with a 16×24 thumb, for compact settings rows.

Secondary

A neutral-150 track for neutral-50 panels, where the primary track would disappear.

Field

SliderField puts the label on the left, the value in a small field on the right, and the slider below. Type a number and press Enter, or use the arrow keys.

Best practices

When to use

  • Use for choosing a value on a scale where position matters more than the exact number: speaking speed, interruption sensitivity, volume.
  • Use mode="dots" when there are a few meaningful steps (up to about ten), and continuous for a smooth range. Use Input when people need to type an exact value.

Behavior

  • Dots mode snaps to every step, and the thumb holds a little on each dot as it is dragged past. Continuous follows the pointer exactly.
  • Clicking the track moves the thumb there and settles without overshoot. onValueChange fires while dragging; onValueCommit fires once when the value settles, so save there.
  • Use size="sm" (20px track) in compact settings rows and the default 40px track elsewhere.
  • Use variant="secondary" (neutral-150 track) on neutral-50 panels; primary (neutral-100) is for white panels.

Content

  • Name the setting in a visible label next to the slider, and show the current value or the scale ends (“Slow”, “Fast”) when the number alone is not meaningful.

Accessibility

  • Always pass aria-label or aria-labelledby. The thumb is a slider with arrow keys, Page Up/Down, Home and End; pass getAriaValueText when the number needs words, like “1.2× speed”.