Repository navigation
feat(slider): add Slider, with iOS's knob, Material 3's handle or a range input - #81
Merged
Merged
Conversation
…ange input Slider picks a number by tapping or dragging along a track, drawn each design's way: iOS's white knob on a thin track, Material 3's slim handle with gaps, stop dots and a value bubble, or a browser's range input with a hover and press halo. onChange fires on release and onValueChanging on every step of a drag. It takes min, max and step, two thumbs with range, step dots, labelled marks and snapToMarks, a value bubble while dragging or always, icons beside the track, keyboard and screen-reader steps, and RTL. The track pan, the adjustable a11y and key props, and the knob move into core, shared with ColorPicker's sliders. The showcase gains a Display & text screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # package.json # website/docusaurus.config.ts
…re constants and types EDGE_TOLERANCE and CROSS_WEIGHT move to core.constants and WebElement to core.types, as the repo keeps magic values and types; keyboard.utils keeps only its functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new
Slidercomponent that looks native in each design:Features
onChangefires once on release, or on a key or screen-reader step.onValueChangingfires on every step of a drag, for haptics and live previews. This matches the library's wheel convention. Tapping the current value fires neither.min,maxandstep(step={0}for any value).rangegives two thumbs: a touch grabs the nearest one, and they can't cross.showStepsdraws a dot per step, and drops them when they'd be too close together.markstakes dots with optional labels under the track.snapToMarksrestricts the value to the marks, like MUI'sstep={null}.valueLabelis'never' | 'drag' | 'always'.'always'keeps room above the track for it.formatValue,minimumIcon/maximumIcon,disabled, and slot styles (containertrackactiveTrackthumbmarkmarkLabelvalueLabelvalueLabelText).Shared with ColorPicker
These moved into
core, and ColorPicker's sliders and pad use them now:useTrackPan: moved fromcolor; it now takes options and addsonStartandonEnd.adjustableProps: one helper for the adjustable role, screen-reader actions and keys.clamp,clamp01andtoFraction.KNOB_SIZE,KNOB_COLOR,KNOB_SHADOW),TOUCH_TARGET,A11Y_ACTION/ADJUSTABLE_ACTIONS, and the Page Up / Page Down keys.Docs and showcase
Tests
pnpm lint && pnpm typecheck && pnpm testpass (676 tests), and so dopnpm buildandpnpm docs:build. New tests cover:Slideritself: drag then commit, keys and screen-reader actions, range ordering, controlled values, the Material bubble, disabled, snap-to-marks, and the always-on bubble;adjustableProps,useTrackPan's newonStart/onEnd, the track math, and the showcase utils.Writing the tests caught a bug, now fixed: a range's end thumb could be dragged below its start thumb.
I haven't checked it by hand on a device or in a browser yet.
🤖 Generated with Claude Code