Skip to content

update slider to use semantic tokens #34758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

rachethecreator
Copy link

Updates react-slider to use semantic tokens.

Gaps noted here

@rachethecreator rachethecreator self-assigned this Jun 30, 2025
@rachethecreator rachethecreator requested review from a team as code owners June 30, 2025 20:38
Copy link

Pull request demo site: URL

@tudorpopams tudorpopams requested a review from marcosmoura July 1, 2025 12:02
Copy link
Contributor

@Mitch-At-Work Mitch-At-Work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Semantic theme has one weird feature where the bar itself shrinks vs default state on hover/press if they are variant sizes - can see this happening in Kumo theme.

Let's see if we can fix this up so that when indicator size changes the progress bar remains constant, we'll likely need to account for the indicator width during hover/pressed states in width style (or set styles to display the thumb in absolute space to avoid it affecting width at all)

@rachethecreator
Copy link
Author

Looks good!

Semantic theme has one weird feature where the bar itself shrinks vs default state on hover/press if they are variant sizes - can see this happening in Kumo theme.

Let's see if we can fix this up so that when indicator size changes the progress bar remains constant, we'll likely need to account for the indicator width during hover/pressed states in width style (or set styles to display the thumb in absolute space to avoid it affecting width at all)

So figured out that the rail width would change depending on thumb size because of this gridTemplateColumns/Rows: 1fr calc(100% - var(${sliderThumbSizeVar})) 1fr. I've updated it so that each side is set by a padding semantic token, which is how it's done in designs, and the rail takes up rest of the space in between. I've also made sure that the padding tokens in variant fallbacks is set as the same as the current implementation. You can see these changes in the second commit.

The thumb size changing on hover/press is due to the semantic tokens all being different - you have to set ctrlSliderThumbSizeRest/Hover/Pressed all separately for the thumb size to stay the same during all states.

@Mitch-At-Work Mitch-At-Work force-pushed the ryoo/slider-semantic-tokens branch from 75e43a8 to 1e947cc Compare July 11, 2025 17:37
@Mitch-At-Work Mitch-At-Work enabled auto-merge (squash) July 11, 2025 18:10
@Mitch-At-Work Mitch-At-Work merged commit 428641d into microsoft:extended-tokens Jul 11, 2025
10 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants