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

@material-ui/system - Add Grid support #15878

Closed
2 tasks done
techniq opened this issue May 26, 2019 · 3 comments · Fixed by #17326
Closed
2 tasks done

@material-ui/system - Add Grid support #15878

techniq opened this issue May 26, 2019 · 3 comments · Fixed by #17326
Labels
new feature New feature or request package: system Specific to @mui/system

Comments

@techniq
Copy link

techniq commented May 26, 2019

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

Expected Behavior 🤔

Similar to flexbox, it would be nice if CSS Grid properties were supported with @material-ui/system / @material-ui/core/Box like styled-system does.

Current Behavior 😯

No support for CSS Grid properties like gridTemplateColumns, rowGap, etc.

Examples 🌈

<Box display="grid" gridTemplateColumns="1fr" rowGap={8}>
  {/* children */}
</Box>
@eps1lon eps1lon added new feature New feature or request package: system Specific to @mui/system labels May 27, 2019
@peteruithoven
Copy link
Contributor

One simple workaround is to create a custom component with custom style props. For example:

import { styled } from '@material-ui/styles';
import { style, compose } from '@material-ui/system';

export default styled('div')(
  compose(
    style({ prop: 'gridTemplateColumns' }),
    style({ prop: 'gridGap', themeKey: 'spacing' }),
    () => ({
      display: 'grid',
    })
  )
);

This way it's even possibe to use the spacing logic for gridGap, example:

<Grid
  gridGap={[2, 3]}
  gridTemplateColumns="repeat(auto-fill, minmax(13rem, 1fr))"
>
  ...
</Grid>

@cctoni
Copy link

cctoni commented Jun 19, 2019

Just do it in your styled components. To reflect every aspect and features into components would be complete insane. Use grid wise!

@techniq
Copy link
Author

techniq commented Jun 19, 2019

@sourcewars This is only for the Box component (and underlying @material-ui/system) which is kind of the purpose of Box -- to not have to create one-off named styled-components (or emotion, etc) unless deemed necessary. Keeps from having a bunch of one-off Container or Root named components.

LavaToaster added a commit to LavaToaster/material-ui that referenced this issue Sep 5, 2019
Provides the foundations for mui#15878
LavaToaster added a commit to LavaToaster/material-ui that referenced this issue Sep 5, 2019
This was referenced Sep 5, 2019
LavaToaster added a commit to LavaToaster/material-ui that referenced this issue Sep 5, 2019
oliviertassinari pushed a commit to LavaToaster/material-ui that referenced this issue Feb 1, 2020
Provides the foundations for mui#15878
oliviertassinari pushed a commit to LavaToaster/material-ui that referenced this issue Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants