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

[TextField] Documentation Layout section mentions the property margin which is overwritten by an sx style #26703

Closed
italodeandra opened this issue Jun 11, 2021 · 2 comments · Fixed by #26710
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation

Comments

@italodeandra
Copy link

This sections https://github.com/mui-org/material-ui/blob/next/docs/src/pages/components/text-fields/text-fields.md#layout has the following sentence:

margin prop can be used to alter the vertical spacing of inputs. Using none (default) will not apply margins to the FormControl, whereas dense and normal will. dense and normal alter other styles to meet the specification.

The code indeed uses this property

https://github.com/mui-org/material-ui/blob/cf2f6fa90608b109978698fc48120920beaaa51f/docs/src/pages/components/text-fields/LayoutTextFields.tsx#L39

But it is overwritten by this sx style

https://github.com/mui-org/material-ui/blob/cf2f6fa90608b109978698fc48120920beaaa51f/docs/src/pages/components/text-fields/LayoutTextFields.tsx#L13

So everything has the same margin as you can see here

https://next.material-ui.com/components/text-fields/#layout

@vicasas vicasas added the docs Improvements or additions to the documentation label Jun 12, 2021
@vicasas
Copy link
Member

vicasas commented Jun 12, 2021

@italodeandra Thanks for reporting this. I have been reviewing this problem quite a bit since there seems to be or will be a confusion with the margin and dense props.

In v4 size modifies the size of the input while dense modifies the vertical spacing and also the size.

In v5 size modifies the size of the input while dense modifies only the vertical spacing and NOT the size.

Luckily in the migration guide https://next.material-ui.com/guides/migration-v4/#textfield this was already noticed but what about the developers who used dense for both purposes? (size and spacing) should they use size and margin at the same time? cc: @oliviertassinari @mnajdova

I will send a PR to correct the example of the documentation of the layout section.

@oliviertassinari
Copy link
Member

should they use size and margin at the same time?

Yes

@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants