-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Allow minimum and maximum value for component number props #871
Conversation
Your Render PR Server URL is https://toolpad-pr-871.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cc75a1cgqg4eu8ovpdrg. |
proptype is based on json-schema, I think that can describe min and max values. perhaps we should just reuse that? |
I'm still not understanding the minimum width use case and how it should behave. Suppose minimum width is 50px, and I put 100 Selects in one row, what happens? what overflows or wraps? |
didn't know about that, i'll take a look |
i'm still not sure about all that so this PR was just going to add this feature which is probably helpful anyway. we can remove the width prop i added to the i was planning to try things and see what might work or not, and if limiting resizing based on minimum width could be helpful or not, even if the UI can still overflow in some cases (there's probably no way we can really stop it from happening). right now we do have that way of resizing width: full width + resizing containers, but i wasn't sure if we intend for that to be the main way to resize the width of components, and then add some margins controls on top. i guess that could work. maybe we could also add an ability to resize directly on the component at some point, as some users might expect, and having this width prop could help for those cases? maybe we can just add this min/max value feature for now without adding a width prop to the |
Looks like I already solved the whole issue in this PR after all, slightly unintentionally: Screen.Recording.2022-09-01.at.16.40.43.movBy not setting a minimum width directly in the component CSS this kind of issue does not happen, the components always adjust to the width of the container. In the future we can probably improve support for small device screens. So what do you think? In my opinion we can merge this. |
Also if you like this idea we can disable the width control when full-width is enabled, I just don't want to do it ahead of time if we don't want to go in this direction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
👌 |
Initially just intended for this PR to be prep for fixing this issue #826, by using a single source of truth for the minimum component dimensions. But it seems like it's actually a solution, so it closes #826.
Also closes #461
Using it already for
Select
component minimum width as an example.Screen.Recording.2022-08-30.at.19.21.52.mov