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

[system] Prefer styled-components's css prop over Box css #18962

Closed
1 task done
lcswillems opened this issue Dec 23, 2019 · 6 comments · Fixed by #23454
Closed
1 task done

[system] Prefer styled-components's css prop over Box css #18962

lcswillems opened this issue Dec 23, 2019 · 6 comments · Fixed by #23454
Labels
breaking change component: Box The React component. package: system Specific to @mui/system
Milestone

Comments

@lcswillems
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

A css prop had been added in Styled-components v4: https://www.styled-components.com/docs/api#css-prop. It is a very handy way to stylize a component, and personnaly I use it a lot.

However, it doesn't work on the Box component because Box has already a css property. I think it would be preferable not to have one to make it possible to use Styled-components one.

@mbrookes mbrookes added the component: Box The React component. label Dec 24, 2019
@eps1lon
Copy link
Member

eps1lon commented Dec 27, 2019

Could you follow the issue template and include a code example and describe what you expect the transpiled output should look like?

@damir-sirola
Copy link
Contributor

If you want inline styles you can use styles prop

@oliviertassinari oliviertassinari removed the status: waiting for author Issue with insufficient information label Jan 22, 2020
@oliviertassinari
Copy link
Member

@lcswillems What do you think about this plan? #22819 (comment)

@oliviertassinari oliviertassinari added the package: system Specific to @mui/system label Oct 9, 2020
@lcswillems
Copy link
Contributor Author

lcswillems commented Oct 10, 2020

I am not sure about what you ask me to think about precisely but I largely prefer option 2 ("write them under one prop") over the other one for these reasons:

  1. "all system props would be easily discoverable" as @mnajdova said. I don't know how many styling props there are (let's say 50). Then if I want to use a new component I don't know well, it will be very hard to find the properties that are really specific to it.
  2. I prefer when styling props are grouped because I am used to separating css and html or separating css and logic props.

I hope my answer helps, and if I answered about the good thing.

@oliviertassinari oliviertassinari changed the title [Box] Prefer styled-components CSS prop over Material-UI one [system] Prefer styled-components's css prop over Box css Oct 20, 2020
@oliviertassinari
Copy link
Member

I would be in favor of dropping the css helper. I agree with the request, I think that we should avoid conflicts with styled-components/emotion default API, also the sx prop that is worked on in #23053 should cover the use case. @mnajdova What do you think?

@mnajdova
Copy link
Member

mnajdova commented Nov 9, 2020

Now that we have the sx prop is safe to drop the css prop. Will work on a PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: Box The React component. package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants