-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[material-ui][Slider] Labels of the marks goes beyond the block #40544
Comments
Hey @DonikaV, thanks for the feedback! Just to clarify, by making the marks fit the parent container You mean: 1. Make a way to align the labels to the edges of the slider's track or 2. Make the parent container encompass the labels? |
Hey @zanivan, @mj12albert I think the second option which is encompassing the labels by parent container would be a better solution. If you also think that it is better than please assign this to me i will fix this issue. |
The first option will be great, as a workaround I removed labels from the marks and added my custom HTML for labels. But will be great to have something like in your screenshot #1 |
If we go with the first case, I believe we should make it in a way where the user need to opt in to this feature—that mean that I wouldn't change the current default. On the second case, though, maybe it could be a breaking change. I wonder if changing the component to encompass the labels like this wouldn't break the existing layouts. A third way, would be to add @DonikaV's workaround—or another one—as a demo to the docs, so users would be able to learn how to do so. Any thoughts @DiegoAndai @mj12albert ? |
This is what i did. <Grid item xs={12} className="pt-0">
<div className="text-center">
<Slider
marks={marks}
step={10}
defaultValue={MIN}
valueLabelDisplay="auto"
min={MIN}
max={MAX}
onChange={handleChange}
/>
</div>
<div className="slider-marks d-flex flex-between">
<div role="button" onClick={() => setVal(MIN)}>
{formatCurrency(MIN)} min
</div>
<div role="button" onClick={() => setVal(MAX)}>
{formatCurrency(MAX)} max
</div>
</div>
</Grid>
P.S. I am ok with both options, the most important is that they will be visible, and inside the parent container. As I know in MUI flutter is the same issue, my colleague also added custom min and max labels. |
Added example how to add custom labels to the slider because of this issue mui#40544
Hello, done, #40647 Please check if all is good. This is my first contribution to such big project :) |
Steps to reproduce
Link to live example: (required)
Steps:
Current behavior
No response
Expected behavior
Marks fit the parent container
Context
As you can see they are not in the containerYour environment
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: