react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Slider: ticks (marks) & snap to ticks

Open lixiaoyan opened this issue 6 months ago โ€ข 1 comments

Provide a general summary of the feature here

Example: "Alert volume" slider in macOS Settings.

https://github.com/user-attachments/assets/55470628-2a65-48a6-8493-7f2e07285e8e

๐Ÿค” Expected Behavior?

  • Allow to add multiple ticks (marks) to the slider
  • May have optional labels above/below the track
  • Clicking on the label should move the slider to the corresponding value
  • Snap to ticks based on cursor movement (the behavior may vary depending on movement speed)
  • Keyboard actions (e.g. arrow keys) should remain unaffected

๐Ÿ˜ฏ Current Behavior

Currently, React Spectrum and React Aria do not have such features.

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

Use cases:

  • Price slider, includes some ticks for commonly used values
  • Volume balance slider, snap to 0
  • Brightness slider in image editing app, snap to 0

๐Ÿ’ป Examples

No response

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

lixiaoyan avatar May 22 '25 08:05 lixiaoyan

Seems like this is different from just using steps since you can still set the value between steps. I think this is a pretty advanced use case that may be better suited to have implemented by using a controlled value.

reidbarber avatar May 22 '25 15:05 reidbarber