Grid
A 12-column grid that sets each box's width by the screen size.
A 12-column grid that sets each box's width by the screen size.
npm install @mui/material
First time with Material UI? Set it up once.
/**
* Demo from Material UI, https://mui.com/material-ui/ (docs demo BasicGrid)
* MIT License, Copyright (c) 2014 Call-Em-All. Full text: https://github.com/mui/material-ui/blob/master/LICENSE
*/
'use client';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Grid';
const Item = styled(Paper)(({ theme }) => ({
backgroundColor: '#fff',
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: 'center',
color: (theme.vars ?? theme).palette.text.secondary,
...theme.applyStyles('dark', {
backgroundColor: '#1A2027',
}),
}));
export default function BasicGrid() {
return (
<Box sx={{ flexGrow: 1 }}>
<Grid container spacing={2}>
<Grid size={8}>
<Item>size=8</Item>
</Grid>
<Grid size={4}>
<Item>size=4</Item>
</Grid>
<Grid size={4}>
<Item>size=4</Item>
</Grid>
<Grid size={8}>
<Item>size=8</Item>
</Grid>
</Grid>
</Box>
);
}