Skip to content
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

[SliderUnstyled] Improve value label display logic #2

Conversation

ZeeshanTamboli
Copy link
Owner

@ZeeshanTamboli ZeeshanTamboli commented Jan 9, 2023

TO BE MERGED AFTER mui#35770.

Breaking Changes for MUI Base:

- <SliderUnstyled valueLabelDisplay="on" />
+ <SliderUnstyled slots={{ valueLabel: SliderValueLabel }} /> 

The following demo shows how to show value label when it is hovered upon the thumb: https://deploy-preview-35479--material-ui.netlify.app/base/react-slider/#value-label

  • The following classes are removed from sliderUnstyledClasses since they are not needed for value label:
- valueLabel
- valueLabelOpen
- valueLabelCircle
- valueLabelLabel

You can define your own classNames in the custom value label component and target them in CSS.

  • The SliderValueLabelUnstyled component is removed from SliderUnstyled. You can provide your own custom component for the value label.

  • The Value label component hierarchy structure is changed to avoid using React.cloneElement in value label. The value label is now inside the Thumb slot - Thumb -> Input, ValueLabel.


Remove the SliderLabelValueUnstyled component from MUI Base and show the value label by simply hovering on the thumb in SliderUnstyled. Add demo to showcase it (preview below)

Closes mui#35398

@ZeeshanTamboli ZeeshanTamboli changed the base branch from slider/replace-SliderUnstyled-with-useSlider-hook to master January 9, 2023 08:50
@ZeeshanTamboli ZeeshanTamboli changed the base branch from master to slider/replace-SliderUnstyled-with-useSlider-hook January 9, 2023 08:51
@ZeeshanTamboli ZeeshanTamboli changed the title Slider unstyled/remove slider value label and impove logic for value label display prop [SliderUnstyled] Remove slider value label and valueLabelDisplay prop Jan 9, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [SliderUnstyled] Remove slider value label and valueLabelDisplay prop [SliderUnstyled] Improve value label display logic Jan 9, 2023
ZeeshanTamboli and others added 7 commits January 9, 2023 19:29
… SliderUnstyled/remove-SliderValueLabel-and-impove-logic-for-valueLabelDisplay-prop
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants