index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/BasicGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function BasicGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid> </Box> ); }
2,500
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/BasicGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function BasicGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid> </Box> ); }
2,501
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/BasicGrid.tsx.preview
<Grid container spacing={2}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={4}> <Item>xs=4</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid>
2,502
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/CenteredElementGrid.js
import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function CenteredElementGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} minHeight={160}> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/1.jpg" /> </Grid> <Grid display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/2.jpg" /> </Grid> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/3.jpg" /> </Grid> </Grid> </Box> ); }
2,503
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/CenteredElementGrid.tsx
import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function CenteredElementGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} minHeight={160}> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/1.jpg" /> </Grid> <Grid display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/2.jpg" /> </Grid> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/3.jpg" /> </Grid> </Grid> </Box> ); }
2,504
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/CenteredElementGrid.tsx.preview
<Grid container spacing={2} minHeight={160}> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/1.jpg" /> </Grid> <Grid display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/2.jpg" /> </Grid> <Grid xs display="flex" justifyContent="center" alignItems="center"> <Avatar src="/static/images/avatar/3.jpg" /> </Grid> </Grid>
2,505
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ColumnsGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function ColumnsGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} columns={16}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid> </Box> ); }
2,506
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ColumnsGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function ColumnsGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} columns={16}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid> </Box> ); }
2,507
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ColumnsGrid.tsx.preview
<Grid container spacing={2} columns={16}> <Grid xs={8}> <Item>xs=8</Item> </Grid> <Grid xs={8}> <Item>xs=8</Item> </Grid> </Grid>
2,508
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/FullBorderedGrid.js
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function FullBorderedGrid() { return ( <Box sx={{ flexGrow: 1, p: 2 }}> <Grid container spacing={2} sx={{ '--Grid-borderWidth': '1px', borderTop: 'var(--Grid-borderWidth) solid', borderLeft: 'var(--Grid-borderWidth) solid', borderColor: 'divider', '& > div': { borderRight: 'var(--Grid-borderWidth) solid', borderBottom: 'var(--Grid-borderWidth) solid', borderColor: 'divider', }, }} > {[...Array(6)].map((_, index) => ( <Grid key={index} {...{ xs: 12, sm: 6, md: 4, lg: 3 }} minHeight={160} /> ))} </Grid> </Box> ); }
2,509
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/FullBorderedGrid.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function FullBorderedGrid() { return ( <Box sx={{ flexGrow: 1, p: 2 }}> <Grid container spacing={2} sx={{ '--Grid-borderWidth': '1px', borderTop: 'var(--Grid-borderWidth) solid', borderLeft: 'var(--Grid-borderWidth) solid', borderColor: 'divider', '& > div': { borderRight: 'var(--Grid-borderWidth) solid', borderBottom: 'var(--Grid-borderWidth) solid', borderColor: 'divider', }, }} > {[...Array(6)].map((_, index) => ( <Grid key={index} {...{ xs: 12, sm: 6, md: 4, lg: 3 }} minHeight={160} /> ))} </Grid> </Box> ); }
2,510
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/FullWidthGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function FullWidthGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> </Grid> </Box> ); }
2,511
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/FullWidthGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function FullWidthGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> </Grid> </Box> ); }
2,512
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/FullWidthGrid.tsx.preview
<Grid container spacing={2}> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={4}> <Item>xs=6 md=4</Item> </Grid> <Grid xs={6} md={8}> <Item>xs=6 md=8</Item> </Grid> </Grid>
2,513
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/HalfBorderedGrid.js
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function HalfBorderedGrid() { const colWidth = { xs: 12, sm: 6, md: 4, lg: 3 }; return ( <Box sx={{ flexGrow: 1, p: 2 }}> <Grid container spacing={2} sx={(theme) => ({ '--Grid-borderWidth': '1px', borderTop: 'var(--Grid-borderWidth) solid', borderColor: 'divider', '& > div': { borderRight: 'var(--Grid-borderWidth) solid', borderBottom: 'var(--Grid-borderWidth) solid', borderColor: 'divider', ...Object.keys(colWidth).reduce( (result, key) => ({ ...result, [`&:nth-of-type(${12 / colWidth[key]}n)`]: { [theme.breakpoints.only(key)]: { borderRight: 'none', }, }, }), {}, ), }, })} > {[...Array(6)].map((_, index) => ( <Grid key={index} {...colWidth} minHeight={160} /> ))} </Grid> </Box> ); }
2,514
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/HalfBorderedGrid.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; export default function HalfBorderedGrid() { const colWidth = { xs: 12, sm: 6, md: 4, lg: 3 } as const; return ( <Box sx={{ flexGrow: 1, p: 2 }}> <Grid container spacing={2} sx={(theme) => ({ '--Grid-borderWidth': '1px', borderTop: 'var(--Grid-borderWidth) solid', borderColor: 'divider', '& > div': { borderRight: 'var(--Grid-borderWidth) solid', borderBottom: 'var(--Grid-borderWidth) solid', borderColor: 'divider', ...(Object.keys(colWidth) as Array<keyof typeof colWidth>).reduce( (result, key) => ({ ...result, [`&:nth-of-type(${12 / colWidth[key]}n)`]: { [theme.breakpoints.only(key)]: { borderRight: 'none', }, }, }), {}, ), }, })} > {[...Array(6)].map((_, index) => ( <Grid key={index} {...colWidth} minHeight={160} /> ))} </Grid> </Box> ); }
2,515
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/NestedGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function NestedGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={12} md={5} lg={4}> <Item>Email subscribe section</Item> </Grid> <Grid container xs={12} md={7} lg={8} spacing={4}> <Grid xs={6} lg={3}> <Item> <Box id="category-a" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category A </Box> <Box component="ul" aria-labelledby="category-a" sx={{ pl: 2 }}> <li>Link 1.1</li> <li>Link 1.2</li> <li>Link 1.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-b" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category B </Box> <Box component="ul" aria-labelledby="category-b" sx={{ pl: 2 }}> <li>Link 2.1</li> <li>Link 2.2</li> <li>Link 2.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-c" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category C </Box> <Box component="ul" aria-labelledby="category-c" sx={{ pl: 2 }}> <li>Link 3.1</li> <li>Link 3.2</li> <li>Link 3.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-d" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category D </Box> <Box component="ul" aria-labelledby="category-d" sx={{ pl: 2 }}> <li>Link 4.1</li> <li>Link 4.2</li> <li>Link 4.3</li> </Box> </Item> </Grid> </Grid> <Grid xs={12} container justifyContent="space-between" alignItems="center" flexDirection={{ xs: 'column', sm: 'row' }} sx={{ fontSize: '12px' }} > <Grid sx={{ order: { xs: 2, sm: 1 } }}> <Item>© Copyright</Item> </Grid> <Grid container columnSpacing={1} sx={{ order: { xs: 1, sm: 2 } }}> <Grid> <Item>Link A</Item> </Grid> <Grid> <Item>Link B</Item> </Grid> <Grid> <Item>Link C</Item> </Grid> </Grid> </Grid> </Grid> </Box> ); }
2,516
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/NestedGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function NestedGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2}> <Grid xs={12} md={5} lg={4}> <Item>Email subscribe section</Item> </Grid> <Grid container xs={12} md={7} lg={8} spacing={4}> <Grid xs={6} lg={3}> <Item> <Box id="category-a" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category A </Box> <Box component="ul" aria-labelledby="category-a" sx={{ pl: 2 }}> <li>Link 1.1</li> <li>Link 1.2</li> <li>Link 1.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-b" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category B </Box> <Box component="ul" aria-labelledby="category-b" sx={{ pl: 2 }}> <li>Link 2.1</li> <li>Link 2.2</li> <li>Link 2.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-c" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category C </Box> <Box component="ul" aria-labelledby="category-c" sx={{ pl: 2 }}> <li>Link 3.1</li> <li>Link 3.2</li> <li>Link 3.3</li> </Box> </Item> </Grid> <Grid xs={6} lg={3}> <Item> <Box id="category-d" sx={{ fontSize: '12px', textTransform: 'uppercase' }} > Category D </Box> <Box component="ul" aria-labelledby="category-d" sx={{ pl: 2 }}> <li>Link 4.1</li> <li>Link 4.2</li> <li>Link 4.3</li> </Box> </Item> </Grid> </Grid> <Grid xs={12} container justifyContent="space-between" alignItems="center" flexDirection={{ xs: 'column', sm: 'row' }} sx={{ fontSize: '12px' }} > <Grid sx={{ order: { xs: 2, sm: 1 } }}> <Item>© Copyright</Item> </Grid> <Grid container columnSpacing={1} sx={{ order: { xs: 1, sm: 2 } }}> <Grid> <Item>Link A</Item> </Grid> <Grid> <Item>Link B</Item> </Grid> <Grid> <Item>Link C</Item> </Grid> </Grid> </Grid> </Grid> </Box> ); }
2,517
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/NestedGridColumns.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function NestedGridColumns() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} columns={24}> <Grid xs={8}> <Item>xs=8/24</Item> </Grid> <Grid container xs={16}> <Grid xs={12}> <Item>nested xs=12/24</Item> </Grid> <Grid xs={12}> <Item>nested xs=12/24</Item> </Grid> </Grid> <Grid xs={8}> <Item>xs=8/24</Item> </Grid> <Grid container xs={16} columns={12}> <Grid xs={6}> <Item>nested xs=6/12</Item> </Grid> <Grid xs={6}> <Item>nested xs=6/12</Item> </Grid> </Grid> </Grid> </Box> ); }
2,518
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/NestedGridColumns.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function NestedGridColumns() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={2} columns={24}> <Grid xs={8}> <Item>xs=8/24</Item> </Grid> <Grid container xs={16}> <Grid xs={12}> <Item>nested xs=12/24</Item> </Grid> <Grid xs={12}> <Item>nested xs=12/24</Item> </Grid> </Grid> <Grid xs={8}> <Item>xs=8/24</Item> </Grid> <Grid container xs={16} columns={12}> <Grid xs={6}> <Item>nested xs=6/12</Item> </Grid> <Grid xs={6}> <Item>nested xs=6/12</Item> </Grid> </Grid> </Grid> </Box> ); }
2,519
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OffsetGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function OffsetGrid() { return ( <Grid container spacing={3} sx={{ flexGrow: 1 }}> <Grid xs={6} xsOffset={3} md={2} mdOffset={0}> <Item>1</Item> </Grid> <Grid xs={4} md={2} mdOffset="auto"> <Item>2</Item> </Grid> <Grid xs={4} xsOffset={4} md={2} mdOffset={0}> <Item>3</Item> </Grid> <Grid xs md={6} mdOffset={2}> <Item>4</Item> </Grid> </Grid> ); }
2,520
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OffsetGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function OffsetGrid() { return ( <Grid container spacing={3} sx={{ flexGrow: 1 }}> <Grid xs={6} xsOffset={3} md={2} mdOffset={0}> <Item>1</Item> </Grid> <Grid xs={4} md={2} mdOffset="auto"> <Item>2</Item> </Grid> <Grid xs={4} xsOffset={4} md={2} mdOffset={0}> <Item>3</Item> </Grid> <Grid xs md={6} mdOffset={2}> <Item>4</Item> </Grid> </Grid> ); }
2,521
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OffsetGrid.tsx.preview
<Grid container spacing={3} sx={{ flexGrow: 1 }}> <Grid xs={6} xsOffset={3} md={2} mdOffset={0}> <Item>1</Item> </Grid> <Grid xs={4} md={2} mdOffset="auto"> <Item>2</Item> </Grid> <Grid xs={4} xsOffset={4} md={2} mdOffset={0}> <Item>3</Item> </Grid> <Grid xs md={6} mdOffset={2}> <Item>4</Item> </Grid> </Grid>
2,522
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OverflowGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function OverflowGrid() { return ( <Box sx={(theme) => ({ display: 'flex', flexDirection: 'column', gap: 3, width: 200, '& > div': { overflow: 'auto hidden', '&::-webkit-scrollbar': { height: 10, WebkitAppearance: 'none' }, '&::-webkit-scrollbar-thumb': { borderRadius: 8, border: '2px solid', borderColor: theme.palette.mode === 'dark' ? '' : '#E7EBF0', backgroundColor: 'rgba(0 0 0 / 0.5)', }, }, })} > <div> <Grid container spacing={3}> <Grid xs={12}> <Item>Scroll bar appears</Item> </Grid> </Grid> </div> <div> <Grid container spacing={3} disableEqualOverflow> <Grid xs={12}> <Item>`disableEqualOverflow` prevents scrollbar</Item> </Grid> </Grid> </div> </Box> ); }
2,523
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OverflowGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function OverflowGrid() { return ( <Box sx={(theme) => ({ display: 'flex', flexDirection: 'column', gap: 3, width: 200, '& > div': { overflow: 'auto hidden', '&::-webkit-scrollbar': { height: 10, WebkitAppearance: 'none' }, '&::-webkit-scrollbar-thumb': { borderRadius: 8, border: '2px solid', borderColor: theme.palette.mode === 'dark' ? '' : '#E7EBF0', backgroundColor: 'rgba(0 0 0 / 0.5)', }, }, })} > <div> <Grid container spacing={3}> <Grid xs={12}> <Item>Scroll bar appears</Item> </Grid> </Grid> </div> <div> <Grid container spacing={3} disableEqualOverflow> <Grid xs={12}> <Item>`disableEqualOverflow` prevents scrollbar</Item> </Grid> </Grid> </div> </Box> ); }
2,524
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/OverflowGrid.tsx.preview
<div> <Grid container spacing={3}> <Grid xs={12}> <Item>Scroll bar appears</Item> </Grid> </Grid> </div> <div> <Grid container spacing={3} disableEqualOverflow> <Grid xs={12}> <Item>`disableEqualOverflow` prevents scrollbar</Item> </Grid> </Grid> </div>
2,525
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ResponsiveGrid.js
import * as React from 'react'; import { experimentalStyled as styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(2), textAlign: 'center', color: theme.palette.text.secondary, })); export default function ResponsiveGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}> {Array.from(Array(6)).map((_, index) => ( <Grid xs={2} sm={4} md={4} key={index}> <Item>xs=2</Item> </Grid> ))} </Grid> </Box> ); }
2,526
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ResponsiveGrid.tsx
import * as React from 'react'; import { experimentalStyled as styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(2), textAlign: 'center', color: theme.palette.text.secondary, })); export default function ResponsiveGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}> {Array.from(Array(6)).map((_, index) => ( <Grid xs={2} sm={4} md={4} key={index}> <Item>xs=2</Item> </Grid> ))} </Grid> </Box> ); }
2,527
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/ResponsiveGrid.tsx.preview
<Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}> {Array.from(Array(6)).map((_, index) => ( <Grid xs={2} sm={4} md={4} key={index}> <Item>xs=2</Item> </Grid> ))} </Grid>
2,528
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/RowAndColumnSpacing.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2'; import Paper from '@mui/material/Paper'; import Box from '@mui/material/Box'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function RowAndColumnSpacing() { return ( <Box sx={{ width: '100%' }}> <Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}> <Grid xs={6}> <Item>1</Item> </Grid> <Grid xs={6}> <Item>2</Item> </Grid> <Grid xs={6}> <Item>3</Item> </Grid> <Grid xs={6}> <Item>4</Item> </Grid> </Grid> </Box> ); }
2,529
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/RowAndColumnSpacing.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2'; import Paper from '@mui/material/Paper'; import Box from '@mui/material/Box'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function RowAndColumnSpacing() { return ( <Box sx={{ width: '100%' }}> <Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}> <Grid xs={6}> <Item>1</Item> </Grid> <Grid xs={6}> <Item>2</Item> </Grid> <Grid xs={6}> <Item>3</Item> </Grid> <Grid xs={6}> <Item>4</Item> </Grid> </Grid> </Box> ); }
2,530
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/RowAndColumnSpacing.tsx.preview
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 3 }}> <Grid xs={6}> <Item>1</Item> </Grid> <Grid xs={6}> <Item>2</Item> </Grid> <Grid xs={6}> <Item>3</Item> </Grid> <Grid xs={6}> <Item>4</Item> </Grid> </Grid>
2,531
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/SpacingGrid.js
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; import FormLabel from '@mui/material/FormLabel'; import FormControl from '@mui/material/FormControl'; import FormControlLabel from '@mui/material/FormControlLabel'; import RadioGroup from '@mui/material/RadioGroup'; import Radio from '@mui/material/Radio'; import Paper from '@mui/material/Paper'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; export default function SpacingGrid() { const [spacing, setSpacing] = React.useState(2); const handleChange = (event) => { setSpacing(Number(event.target.value)); }; const jsx = ` <Grid container spacing={${spacing}}> `; return ( <Box sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column', gap: 2, pt: 2, '&& pre': { margin: 0 }, }} > <Grid container justifyContent="center" spacing={spacing}> {[0, 1, 2].map((value) => ( <Grid key={value}> <Paper sx={{ height: 140, width: 100, backgroundColor: (theme) => theme.palette.mode === 'dark' ? '#1A2027' : '#fff', }} /> </Grid> ))} </Grid> <Paper sx={{ p: 2 }}> <FormControl component="fieldset"> <FormLabel component="legend">spacing</FormLabel> <RadioGroup name="spacing" aria-label="spacing" value={spacing.toString()} onChange={handleChange} row > {[0, 0.5, 1, 2, 3, 4, 8, 12].map((value) => ( <FormControlLabel key={value} value={value.toString()} control={<Radio />} label={value.toString()} /> ))} </RadioGroup> </FormControl> </Paper> <HighlightedCode code={jsx} language="jsx" /> </Box> ); }
2,532
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/SpacingGrid.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; import FormLabel from '@mui/material/FormLabel'; import FormControl from '@mui/material/FormControl'; import FormControlLabel from '@mui/material/FormControlLabel'; import RadioGroup from '@mui/material/RadioGroup'; import Radio from '@mui/material/Radio'; import Paper from '@mui/material/Paper'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; export default function SpacingGrid() { const [spacing, setSpacing] = React.useState(2); const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { setSpacing(Number((event.target as HTMLInputElement).value)); }; const jsx = ` <Grid container spacing={${spacing}}> `; return ( <Box sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column', gap: 2, pt: 2, '&& pre': { margin: 0 }, }} > <Grid container justifyContent="center" spacing={spacing}> {[0, 1, 2].map((value) => ( <Grid key={value}> <Paper sx={{ height: 140, width: 100, backgroundColor: (theme) => theme.palette.mode === 'dark' ? '#1A2027' : '#fff', }} /> </Grid> ))} </Grid> <Paper sx={{ p: 2 }}> <FormControl component="fieldset"> <FormLabel component="legend">spacing</FormLabel> <RadioGroup name="spacing" aria-label="spacing" value={spacing.toString()} onChange={handleChange} row > {[0, 0.5, 1, 2, 3, 4, 8, 12].map((value) => ( <FormControlLabel key={value} value={value.toString()} control={<Radio />} label={value.toString()} /> ))} </RadioGroup> </FormControl> </Paper> <HighlightedCode code={jsx} language="jsx" /> </Box> ); }
2,533
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/VariableWidthGrid.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function VariableWidthGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={3}> <Grid xs="auto"> <Item>variable width content</Item> </Grid> <Grid xs={6}> <Item>xs=6</Item> </Grid> <Grid xs> <Item>xs</Item> </Grid> </Grid> </Box> ); }
2,534
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/VariableWidthGrid.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Unstable_Grid2'; const Item = styled(Paper)(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff', ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'center', color: theme.palette.text.secondary, })); export default function VariableWidthGrid() { return ( <Box sx={{ flexGrow: 1 }}> <Grid container spacing={3}> <Grid xs="auto"> <Item>variable width content</Item> </Grid> <Grid xs={6}> <Item>xs=6</Item> </Grid> <Grid xs> <Item>xs</Item> </Grid> </Grid> </Box> ); }
2,535
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/VariableWidthGrid.tsx.preview
<Grid container spacing={3}> <Grid xs="auto"> <Item>variable width content</Item> </Grid> <Grid xs={6}> <Item>xs=6</Item> </Grid> <Grid xs> <Item>xs</Item> </Grid> </Grid>
2,536
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/grid2/grid2.md
--- productId: material-ui title: React Grid component githubLabel: 'component: Grid' materialDesign: https://m2.material.io/design/layout/understanding-layout.html --- # Grid version 2 <p class="description">The responsive layout grid adapts to screen size and orientation, ensuring consistency across layouts.</p> {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} The `Grid` component works well for a layout with a known number of columns. The columns can be configured with multiple breakpoints to specify the column span of each child. ## What's changed We built the `Grid` component from scratch in order to: - Fix [known issues](https://github.com/mui/material-ui/pull/32746) introduced in Material UI v5. - Simplify the logic with CSS variables, removing the unnecessary `item` prop and reducing CSS specificity. - Introduce a proper fix for [preventing a scrollbar](#prevent-scrollbar) by switching between negative margin approaches. - Set negative margins of equal size on all sides of the grid container by default. Since the new implementation is considered a breaking change, we introduced it as `Unstable_Grid2` to gather feedbacks from the community before making it stable in the next major release of Material UI. We encourage everyone to try the new version of the `Grid` by visiting the [Grid v2 migration guide](/material-ui/migration/migration-grid-v2/). :::info From now on, the `Grid` v1 and `Grid` v2 refer to the import as: ```js import Grid from '@mui/material/Grid'; // Grid version 1 import Grid from '@mui/material/Unstable_Grid2'; // Grid version 2 ``` ::: ## How it works The grid system is implemented with the `Grid` component: - It uses [CSS Flexbox](https://www.w3.org/TR/css-flexbox-1/) (rather than CSS Grid) for high flexibility. - The grid is always a flex item. Use the `container` prop to add a flex container. - Item widths are set in percentages, so they're always fluid and sized relative to their parent element. - There are five default grid breakpoints: xs, sm, md, lg, and xl. If you need custom breakpoints, check out [custom breakpoints grid](#custom-breakpoints). - You can give integer values for each breakpoint, to indicate how many of the 12 available columns are occupied by the component when the viewport width satisfies the [breakpoint constraints](/material-ui/customization/breakpoints/#default-breakpoints). - It uses negative margins and padding to create gaps between children, which behave similarly to [the `gap` CSS property](https://developer.mozilla.org/en-US/docs/Web/CSS/gap). - It does _not_ support row spanning. Children elements cannot span multiple rows. We recommend using [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) if you need this functionality. - It does _not_ automatically place children. It will try to fit the children one by one, and if there is not enough space, the rest of the children will start on the next line, and so on. If you need auto-placement, we recommend using [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Auto-placement_in_grid_layout) instead. :::warning The `Grid` component is a _layout_ grid, not a _data_ grid. If you need a data grid, check out [the MUI X `DataGrid` component](/x/react-data-grid/). ::: ## Fluid grids Fluid grids use columns that scale and resize content. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. ### Basic grid In order to create a grid layout, you need a container. Use the `container` prop to create a grid container that wraps the grid items (the `Grid` is always an item). Column widths are integer values between 1 and 12. They can be applied at any breakpoint to indicate how many columns are occupied by the component. A value given to a breakpoint applies to all the other wider breakpoints unless overridden—see [Multiple breakpoints](#multiple-breakpoints) for details. For example, a component with `xs={12}` occupies the whole viewport width regardless of its size. {{"demo": "BasicGrid.js", "bg": true}} ### Multiple breakpoints Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. For example, a component with `xs={12} sm={6}` occupies the entire viewport width when the viewport is [less than 600 pixels wide](/material-ui/customization/breakpoints/#default-breakpoints). When the viewport grows beyond this size, the component occupies half of the total width—six columns rather than 12. {{"demo": "FullWidthGrid.js", "bg": true}} ## Spacing Use the `spacing` prop to control the space between children. The spacing value can be any positive number (including decimals) or a string. The prop is converted into a CSS property using the [`theme.spacing()`](/material-ui/customization/spacing/) helper. The following demo illustrates the use of the `spacing` prop: {{"demo": "SpacingGrid.js", "bg": true, "hideToolbar": true}} ### Row and column spacing The `rowSpacing` and `columnSpacing` props let you specify row and column gaps independently of one another. They behave similarly to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). {{"demo": "RowAndColumnSpacing.js", "bg": true}} ## Responsive values You can set prop values to change when a given breakpoint is active. For instance, we can implement Material Design's [recommended](https://m2.material.io/design/layout/responsive-layout-grid.html) responsive layout grid, as seen in the following demo: {{"demo": "ResponsiveGrid.js", "bg": true}} Responsive values are supported by: - `columns` - `columnSpacing` - `direction` - `rowSpacing` - `spacing` - all other [MUI System props](#system-props) ## Auto-layout The auto-layout feature gives equal space to all items present. When you set the width of one item, the others will automatically resize to match it. {{"demo": "AutoGrid.js", "bg": true}} ### Variable width content When a breakpoint's value is given as `"auto"` instead of `true` or a number, then a column's size will automatically adjust to match the width of its content. The demo below shows how this works: {{"demo": "VariableWidthGrid.js", "bg": true}} ## Nested grid The grid container that renders as a **direct child** inside another grid container is a nested grid that inherits its [`columns`](#columns) and [`spacing`](#spacing) from the top level. It will also inherit the props of the top-level grid if it receives those props. :::success Note that a nested grid container should be a direct child of another grid container. If there are non-grid elements in between, the grid container will start as the new root container. ```js <Grid container> <Grid container> // A nested grid container that inherits columns and spacing from above. <div> <Grid container> // A new root grid container with its own variables scope. ``` ::: ### Inheriting spacing A nested grid container will inherits the row and column spacing from its parent unless the `spacing` prop is specified to the instance. {{"demo": "NestedGrid.js", "bg": true}} ### Inheriting columns A nested grid container will inherits the columns from its parent unless the `columns` prop is specified to the instance. {{"demo": "NestedGridColumns.js", "bg": true}} ## Columns Use the `columns` prop to change the default number of columns (12) in the grid, as shown below: {{"demo": "ColumnsGrid.js", "bg": true}} ## Offset Offset props (such as `smOffset`, `mdOffset`) push an item to the right side of the grid. These props accept: - numbers—for example, `mdOffset={2}` pushes an item two columns to the right when the viewport size is equal to or greater than the `md` breakpoint. - `"auto"`—this pushes the item to the far right side of the grid container. The demo below illustrates how to use the offset props: {{"demo": "OffsetGrid.js", "bg": true}} ## Custom breakpoints If you specify custom breakpoints in the theme, you can use those names as grid item props in responsive values: ```js import { ThemeProvider, createTheme } from '@mui/material/styles'; function Demo() { return ( <ThemeProvider theme={createTheme({ breakpoints: { values: { laptop: 1024, tablet: 640, mobile: 0, desktop: 1280, }, }, })} > <Grid container spacing={{ mobile: 1, tablet: 2, laptop: 3 }}> {Array.from(Array(4)).map((_, index) => ( <Grid mobile={6} tablet={4} laptop={3} key={index}> <div>{index + 1}</div> </Grid> ))} </Grid> </ThemeProvider> ); } ``` :::info Custom breakpoints affect both size and offset props: ```diff - <Grid xs={6} xsOffset={2}> + <Grid mobile={6} mobileOffset={2}> ``` ::: ### TypeScript You have to set module augmentation on the theme breakpoints interface. Properties set to `true` will appear as `{key}`(size prop) and `{key}Offset`(offset prop). ```ts declare module '@mui/system' { interface BreakpointOverrides { // Your custom breakpoints laptop: true; tablet: true; mobile: true; desktop: true; // Remove default breakpoints xs: false; sm: false; md: false; lg: false; xl: false; } } ``` ## Disable the scrollbar If you use grid as a container in a small viewport, you might see a horizontal scrollbar because the negative margin is applied on all sides of the grid container. To disable this scrollbar, set the `disableEqualOverflow` prop to `true`. This removes the negative margins from the bottom and right sides of the grid to prevent overflow. The demo below shows how this works: {{"demo": "OverflowGrid.js", "bg": true}} :::warning You should avoid adding borders and backgrounds to the grid when `disableEqualOverflow` is `true` because the negative margin (applied only at the top and left sides) causes the grid to be visually misaligned. ::: ## Customization ### Centered elements To center a grid item's content, specify `display="flex"` directly on the item. Then use `justifyContent` and/or `alignItems` to adjust the position of the content, as shown below: {{"demo": "CenteredElementGrid.js", "bg": true}} :::warning Using the `container` prop does not work in this situation because the grid container is designed exclusively to wrap grid items. It cannot wrap other elements. ::: ### Full border {{"demo": "FullBorderedGrid.js"}} ### Half border {{"demo": "HalfBorderedGrid.js"}} ## Limitations ### Column direction and reversing The column width (`xs`, ..., `xl`) and offset props are _not_ supported within containers that use `direction="column"` or `direction="column-reverse"`. Size and offset props define the number of columns the component will use for a given breakpoint. They are intended to control the width using `flex-basis` in `row` containers, but they will impact the height in `column` containers. If used, these props may have undesirable effects on the height of the `Grid` item elements.
2,537
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/hidden/hidden.md
--- productId: material-ui title: React Hidden component description: The Hidden component is deprecated, check out the migration guide for more details. components: Hidden githubLabel: 'component: Hidden' --- # Hidden :::error The Hidden component was deprecated in Material UI v5. To learn more, see [the Hidden section](/material-ui/migration/v5-component-changes/#hidden) of the migration docs. ::: <p class="description"></p> {{"component": "modules/components/ComponentLinkHeader.js", "design": false}}
2,538
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/CreateSvgIcon.js
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { createSvgIcon } from '@mui/material/utils'; const HomeIcon = createSvgIcon( <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />, 'Home', ); const PlusIcon = createSvgIcon( // credit: plus icon from https://heroicons.com/ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg>, 'Plus', ); export default function CreateSvgIcon() { return ( <Stack direction="row" spacing={3}> <HomeIcon /> <HomeIcon color="primary" /> <PlusIcon /> <PlusIcon color="secondary" /> </Stack> ); }
2,539
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/CreateSvgIcon.tsx
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { createSvgIcon } from '@mui/material/utils'; const HomeIcon = createSvgIcon( <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />, 'Home', ); const PlusIcon = createSvgIcon( // credit: plus icon from https://heroicons.com/ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg>, 'Plus', ); export default function CreateSvgIcon() { return ( <Stack direction="row" spacing={3}> <HomeIcon /> <HomeIcon color="primary" /> <PlusIcon /> <PlusIcon color="secondary" /> </Stack> ); }
2,540
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/CreateSvgIcon.tsx.preview
<HomeIcon /> <HomeIcon color="primary" /> <PlusIcon /> <PlusIcon color="secondary" />
2,541
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIcon.js
import * as React from 'react'; import { loadCSS } from 'fg-loadcss'; import Stack from '@mui/material/Stack'; import { green } from '@mui/material/colors'; import Icon from '@mui/material/Icon'; export default function FontAwesomeIcon() { React.useEffect(() => { const node = loadCSS( 'https://use.fontawesome.com/releases/v5.14.0/css/all.css', // Inject before JSS document.querySelector('#font-awesome-css') || document.head.firstChild, ); return () => { node.parentNode.removeChild(node); }; }, []); return ( <Stack direction="row" spacing={4} alignItems="flex-end"> <Icon baseClassName="fas" className="fa-plus-circle" /> <Icon baseClassName="fas" className="fa-plus-circle" color="primary" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ color: green[500] }} /> <Icon baseClassName="fas" className="fa-plus-circle" fontSize="small" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ fontSize: 30 }} /> </Stack> ); }
2,542
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIcon.tsx
import * as React from 'react'; import { loadCSS } from 'fg-loadcss'; import Stack from '@mui/material/Stack'; import { green } from '@mui/material/colors'; import Icon from '@mui/material/Icon'; export default function FontAwesomeIcon() { React.useEffect(() => { const node = loadCSS( 'https://use.fontawesome.com/releases/v5.14.0/css/all.css', // Inject before JSS document.querySelector('#font-awesome-css') || document.head.firstChild, ); return () => { node.parentNode!.removeChild(node); }; }, []); return ( <Stack direction="row" spacing={4} alignItems="flex-end"> <Icon baseClassName="fas" className="fa-plus-circle" /> <Icon baseClassName="fas" className="fa-plus-circle" color="primary" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ color: green[500] }} /> <Icon baseClassName="fas" className="fa-plus-circle" fontSize="small" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ fontSize: 30 }} /> </Stack> ); }
2,543
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIcon.tsx.preview
<Icon baseClassName="fas" className="fa-plus-circle" /> <Icon baseClassName="fas" className="fa-plus-circle" color="primary" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ color: green[500] }} /> <Icon baseClassName="fas" className="fa-plus-circle" fontSize="small" /> <Icon baseClassName="fas" className="fa-plus-circle" sx={{ fontSize: 30 }} />
2,544
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIconSize.js
import * as React from 'react'; import { loadCSS } from 'fg-loadcss'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import Stack from '@mui/material/Stack'; import Icon from '@mui/material/Icon'; import MdPhone from '@mui/icons-material/Phone'; import Chip from '@mui/material/Chip'; const theme = createTheme({ components: { MuiIcon: { styleOverrides: { root: { // Match 24px = 3 * 2 + 1.125 * 16 boxSizing: 'content-box', padding: 3, fontSize: '1.125rem', }, }, }, }, }); export default function FontAwesomeIconSize() { React.useEffect(() => { const node = loadCSS( 'https://use.fontawesome.com/releases/v5.14.0/css/all.css', // Inject before JSS document.querySelector('#font-awesome-css') || document.head.firstChild, ); return () => { node.parentNode.removeChild(node); }; }, []); return ( <Stack direction="row" spacing={2}> <ThemeProvider theme={theme}> <Chip icon={<MdPhone />} label="Call me" /> <Chip icon={<Icon className="fas fa-phone-alt" />} label="Call me" /> </ThemeProvider> </Stack> ); }
2,545
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIconSize.tsx
import * as React from 'react'; import { loadCSS } from 'fg-loadcss'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import Stack from '@mui/material/Stack'; import Icon from '@mui/material/Icon'; import MdPhone from '@mui/icons-material/Phone'; import Chip from '@mui/material/Chip'; const theme = createTheme({ components: { MuiIcon: { styleOverrides: { root: { // Match 24px = 3 * 2 + 1.125 * 16 boxSizing: 'content-box', padding: 3, fontSize: '1.125rem', }, }, }, }, }); export default function FontAwesomeIconSize() { React.useEffect(() => { const node = loadCSS( 'https://use.fontawesome.com/releases/v5.14.0/css/all.css', // Inject before JSS document.querySelector('#font-awesome-css') || document.head.firstChild, ); return () => { node.parentNode!.removeChild(node); }; }, []); return ( <Stack direction="row" spacing={2}> <ThemeProvider theme={theme}> <Chip icon={<MdPhone />} label="Call me" /> <Chip icon={<Icon className="fas fa-phone-alt" />} label="Call me" /> </ThemeProvider> </Stack> ); }
2,546
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeIconSize.tsx.preview
<ThemeProvider theme={theme}> <Chip icon={<MdPhone />} label="Call me" /> <Chip icon={<Icon className="fas fa-phone-alt" />} label="Call me" /> </ThemeProvider>
2,547
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeSvgIconDemo.js
import * as React from 'react'; import PropTypes from 'prop-types'; import { faEllipsisV } from '@fortawesome/free-solid-svg-icons/faEllipsisV'; import { faInfo } from '@fortawesome/free-solid-svg-icons/faInfo'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import Stack from '@mui/material/Stack'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import SvgIcon from '@mui/material/SvgIcon'; const FontAwesomeSvgIcon = React.forwardRef((props, ref) => { const { icon } = props; const { icon: [width, height, , , svgPathData], } = icon; return ( <SvgIcon ref={ref} viewBox={`0 0 ${width} ${height}`}> {typeof svgPathData === 'string' ? ( <path d={svgPathData} /> ) : ( /** * A multi-path Font Awesome icon seems to imply a duotune icon. The 0th path seems to * be the faded element (referred to as the "secondary" path in the Font Awesome docs) * of a duotone icon. 40% is the default opacity. * * @see https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons#changing-opacity */ svgPathData.map((d, i) => ( <path style={{ opacity: i === 0 ? 0.4 : 1 }} d={d} /> )) )} </SvgIcon> ); }); FontAwesomeSvgIcon.propTypes = { icon: PropTypes.any.isRequired, }; export default function FontAwesomeSvgIconDemo() { return ( <Stack direction="row" spacing={2}> <IconButton aria-label="Example"> <FontAwesomeIcon icon={faEllipsisV} /> </IconButton> <IconButton aria-label="Example"> <FontAwesomeSvgIcon icon={faEllipsisV} /> </IconButton> <Button variant="contained" startIcon={<FontAwesomeIcon icon={faInfo} />}> Example </Button> <Button variant="contained" startIcon={<FontAwesomeSvgIcon icon={faInfo} />}> Example </Button> </Stack> ); }
2,548
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeSvgIconDemo.tsx
import * as React from 'react'; import { faEllipsisV } from '@fortawesome/free-solid-svg-icons/faEllipsisV'; import { faInfo } from '@fortawesome/free-solid-svg-icons/faInfo'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import Stack from '@mui/material/Stack'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import SvgIcon from '@mui/material/SvgIcon'; type FontAwesomeSvgIconProps = { icon: any; }; const FontAwesomeSvgIcon = React.forwardRef<SVGSVGElement, FontAwesomeSvgIconProps>( (props, ref) => { const { icon } = props; const { icon: [width, height, , , svgPathData], } = icon; return ( <SvgIcon ref={ref} viewBox={`0 0 ${width} ${height}`}> {typeof svgPathData === 'string' ? ( <path d={svgPathData} /> ) : ( /** * A multi-path Font Awesome icon seems to imply a duotune icon. The 0th path seems to * be the faded element (referred to as the "secondary" path in the Font Awesome docs) * of a duotone icon. 40% is the default opacity. * * @see https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons#changing-opacity */ svgPathData.map((d: string, i: number) => ( <path style={{ opacity: i === 0 ? 0.4 : 1 }} d={d} /> )) )} </SvgIcon> ); }, ); export default function FontAwesomeSvgIconDemo() { return ( <Stack direction="row" spacing={2}> <IconButton aria-label="Example"> <FontAwesomeIcon icon={faEllipsisV} /> </IconButton> <IconButton aria-label="Example"> <FontAwesomeSvgIcon icon={faEllipsisV} /> </IconButton> <Button variant="contained" startIcon={<FontAwesomeIcon icon={faInfo} />}> Example </Button> <Button variant="contained" startIcon={<FontAwesomeSvgIcon icon={faInfo} />}> Example </Button> </Stack> ); }
2,549
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/FontAwesomeSvgIconDemo.tsx.preview
<IconButton aria-label="Example"> <FontAwesomeIcon icon={faEllipsisV} /> </IconButton> <IconButton aria-label="Example"> <FontAwesomeSvgIcon icon={faEllipsisV} /> </IconButton> <Button variant="contained" startIcon={<FontAwesomeIcon icon={faInfo} />}> Example </Button> <Button variant="contained" startIcon={<FontAwesomeSvgIcon icon={faInfo} />}> Example </Button>
2,550
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/Icons.js
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { green } from '@mui/material/colors'; import Icon from '@mui/material/Icon'; export default function Icons() { return ( <Stack direction="row" spacing={3}> <Icon>add_circle</Icon> <Icon color="primary">add_circle</Icon> <Icon sx={{ color: green[500] }}>add_circle</Icon> <Icon fontSize="small">add_circle</Icon> <Icon sx={{ fontSize: 30 }}>add_circle</Icon> </Stack> ); }
2,551
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/Icons.tsx
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { green } from '@mui/material/colors'; import Icon from '@mui/material/Icon'; export default function Icons() { return ( <Stack direction="row" spacing={3}> <Icon>add_circle</Icon> <Icon color="primary">add_circle</Icon> <Icon sx={{ color: green[500] }}>add_circle</Icon> <Icon fontSize="small">add_circle</Icon> <Icon sx={{ fontSize: 30 }}>add_circle</Icon> </Stack> ); }
2,552
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/Icons.tsx.preview
<Icon>add_circle</Icon> <Icon color="primary">add_circle</Icon> <Icon sx={{ color: green[500] }}>add_circle</Icon> <Icon fontSize="small">add_circle</Icon> <Icon sx={{ fontSize: 30 }}>add_circle</Icon>
2,553
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconChildren.js
import * as React from 'react'; import SvgIcon from '@mui/material/SvgIcon'; export default function SvgIconChildren() { return ( <SvgIcon> {/* credit: plus icon from https://heroicons.com/ */} <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495" /> </svg> </SvgIcon> ); }
2,554
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconChildren.tsx
import * as React from 'react'; import SvgIcon from '@mui/material/SvgIcon'; export default function SvgIconChildren() { return ( <SvgIcon> {/* credit: plus icon from https://heroicons.com/ */} <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495" /> </svg> </SvgIcon> ); }
2,555
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconChildren.tsx.preview
<SvgIcon> {/* credit: plus icon from https://heroicons.com/ */} <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495" /> </svg> </SvgIcon>
2,556
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsColor.js
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { pink } from '@mui/material/colors'; import SvgIcon from '@mui/material/SvgIcon'; function HomeIcon(props) { return ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> </SvgIcon> ); } export default function SvgIconsColor() { return ( <Stack direction="row" spacing={3}> <HomeIcon /> <HomeIcon color="primary" /> <HomeIcon color="secondary" /> <HomeIcon color="success" /> <HomeIcon color="action" /> <HomeIcon color="disabled" /> <HomeIcon sx={{ color: pink[500] }} /> </Stack> ); }
2,557
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsColor.tsx
import * as React from 'react'; import Stack from '@mui/material/Stack'; import { pink } from '@mui/material/colors'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; function HomeIcon(props: SvgIconProps) { return ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> </SvgIcon> ); } export default function SvgIconsColor() { return ( <Stack direction="row" spacing={3}> <HomeIcon /> <HomeIcon color="primary" /> <HomeIcon color="secondary" /> <HomeIcon color="success" /> <HomeIcon color="action" /> <HomeIcon color="disabled" /> <HomeIcon sx={{ color: pink[500] }} /> </Stack> ); }
2,558
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsColor.tsx.preview
<HomeIcon /> <HomeIcon color="primary" /> <HomeIcon color="secondary" /> <HomeIcon color="success" /> <HomeIcon color="action" /> <HomeIcon color="disabled" /> <HomeIcon sx={{ color: pink[500] }} />
2,559
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsSize.js
import * as React from 'react'; import Stack from '@mui/material/Stack'; import SvgIcon from '@mui/material/SvgIcon'; function HomeIcon(props) { return ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> </SvgIcon> ); } export default function SvgIconsSize() { return ( <Stack direction="row" spacing={3} alignItems="flex-end"> <HomeIcon fontSize="small" /> <HomeIcon /> <HomeIcon fontSize="large" /> <HomeIcon sx={{ fontSize: 40 }} /> </Stack> ); }
2,560
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsSize.tsx
import * as React from 'react'; import Stack from '@mui/material/Stack'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; function HomeIcon(props: SvgIconProps) { return ( <SvgIcon {...props}> <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" /> </SvgIcon> ); } export default function SvgIconsSize() { return ( <Stack direction="row" spacing={3} alignItems="flex-end"> <HomeIcon fontSize="small" /> <HomeIcon /> <HomeIcon fontSize="large" /> <HomeIcon sx={{ fontSize: 40 }} /> </Stack> ); }
2,561
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgIconsSize.tsx.preview
<HomeIcon fontSize="small" /> <HomeIcon /> <HomeIcon fontSize="large" /> <HomeIcon sx={{ fontSize: 40 }} />
2,562
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgMaterialIcons.js
import * as React from 'react'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import DeleteIcon from '@mui/icons-material/Delete'; import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined'; import DeleteRoundedIcon from '@mui/icons-material/DeleteRounded'; import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone'; import DeleteSharpIcon from '@mui/icons-material/DeleteSharp'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; import DeleteForeverOutlinedIcon from '@mui/icons-material/DeleteForeverOutlined'; import DeleteForeverRoundedIcon from '@mui/icons-material/DeleteForeverRounded'; import DeleteForeverTwoToneIcon from '@mui/icons-material/DeleteForeverTwoTone'; import DeleteForeverSharpIcon from '@mui/icons-material/DeleteForeverSharp'; import ThreeDRotationIcon from '@mui/icons-material/ThreeDRotation'; import FourKIcon from '@mui/icons-material/FourK'; import ThreeSixtyIcon from '@mui/icons-material/ThreeSixty'; export default function SvgMaterialIcons() { return ( <Grid container sx={{ color: 'text.primary' }}> <Grid item xs={4}> <Typography>Filled</Typography> </Grid> <Grid item xs={8}> <DeleteIcon /> <DeleteForeverIcon /> </Grid> <Grid item xs={4}> <Typography>Outlined</Typography> </Grid> <Grid item xs={8}> <DeleteOutlinedIcon /> <DeleteForeverOutlinedIcon /> </Grid> <Grid item xs={4}> <Typography>Rounded</Typography> </Grid> <Grid item xs={8}> <DeleteRoundedIcon /> <DeleteForeverRoundedIcon /> </Grid> <Grid item xs={4}> <Typography>Two Tone</Typography> </Grid> <Grid item xs={8}> <DeleteTwoToneIcon /> <DeleteForeverTwoToneIcon /> </Grid> <Grid item xs={4}> <Typography>Sharp</Typography> </Grid> <Grid item xs={8}> <DeleteSharpIcon /> <DeleteForeverSharpIcon /> </Grid> <Grid item xs={4}> <Typography>Edge-cases</Typography> </Grid> <Grid item xs={8}> <ThreeDRotationIcon /> <FourKIcon /> <ThreeSixtyIcon /> </Grid> </Grid> ); }
2,563
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/SvgMaterialIcons.tsx
import * as React from 'react'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import DeleteIcon from '@mui/icons-material/Delete'; import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined'; import DeleteRoundedIcon from '@mui/icons-material/DeleteRounded'; import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone'; import DeleteSharpIcon from '@mui/icons-material/DeleteSharp'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; import DeleteForeverOutlinedIcon from '@mui/icons-material/DeleteForeverOutlined'; import DeleteForeverRoundedIcon from '@mui/icons-material/DeleteForeverRounded'; import DeleteForeverTwoToneIcon from '@mui/icons-material/DeleteForeverTwoTone'; import DeleteForeverSharpIcon from '@mui/icons-material/DeleteForeverSharp'; import ThreeDRotationIcon from '@mui/icons-material/ThreeDRotation'; import FourKIcon from '@mui/icons-material/FourK'; import ThreeSixtyIcon from '@mui/icons-material/ThreeSixty'; export default function SvgMaterialIcons() { return ( <Grid container sx={{ color: 'text.primary' }}> <Grid item xs={4}> <Typography>Filled</Typography> </Grid> <Grid item xs={8}> <DeleteIcon /> <DeleteForeverIcon /> </Grid> <Grid item xs={4}> <Typography>Outlined</Typography> </Grid> <Grid item xs={8}> <DeleteOutlinedIcon /> <DeleteForeverOutlinedIcon /> </Grid> <Grid item xs={4}> <Typography>Rounded</Typography> </Grid> <Grid item xs={8}> <DeleteRoundedIcon /> <DeleteForeverRoundedIcon /> </Grid> <Grid item xs={4}> <Typography>Two Tone</Typography> </Grid> <Grid item xs={8}> <DeleteTwoToneIcon /> <DeleteForeverTwoToneIcon /> </Grid> <Grid item xs={4}> <Typography>Sharp</Typography> </Grid> <Grid item xs={8}> <DeleteSharpIcon /> <DeleteForeverSharpIcon /> </Grid> <Grid item xs={4}> <Typography>Edge-cases</Typography> </Grid> <Grid item xs={8}> <ThreeDRotationIcon /> <FourKIcon /> <ThreeSixtyIcon /> </Grid> </Grid> ); }
2,564
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/TwoToneIcons.js
import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import Icon from '@mui/material/Icon'; const useIsDarkMode = () => { const theme = useTheme(); return theme.palette.mode === 'dark'; }; export default function TwoToneIcons() { const isDarkMode = useIsDarkMode(); return ( <Icon sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }} baseClassName="material-icons-two-tone" > add_circle </Icon> ); }
2,565
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/TwoToneIcons.tsx
import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import Icon from '@mui/material/Icon'; const useIsDarkMode = () => { const theme = useTheme(); return theme.palette.mode === 'dark'; }; export default function TwoToneIcons() { const isDarkMode = useIsDarkMode(); return ( <Icon sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }} baseClassName="material-icons-two-tone" > add_circle </Icon> ); }
2,566
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/TwoToneIcons.tsx.preview
<Icon sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }} baseClassName="material-icons-two-tone" > add_circle </Icon>
2,567
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/icons/icons.md
--- productId: material-ui title: React Icon Component components: Icon, SvgIcon githubLabel: 'components: SvgIcon' materialDesign: https://m2.material.io/design/iconography/system-icons.html --- # Icons <p class="description">Guidance and suggestions for using icons with Material UI.</p> Material UI provides icon support in three ways: 1. With [Material Icons](#material-svg-icons) exported as React components (SVG icons). 1. With the [SvgIcon](#svgicon) component, a React wrapper for custom SVG icons. 1. With the [Icon](#icon-font-icons) component, a React wrapper for custom font icons. ## Material SVG icons Google has created over 2,100 official [Material icons](https://fonts.google.com/icons?icon.set=Material+Icons), each in five different "themes" (see below). For each SVG icon, we export the respective React component from the `@mui/icons-material` package. You can [search the full list of these icons](/material-ui/material-icons/). ### Installation Run one of the following commands to install it and save it to your `package.json` dependencies: <codeblock storageKey="package-manager"> ```bash npm npm install @mui/icons-material ``` ```bash yarn yarn add @mui/icons-material ``` ```bash pnpm pnpm add @mui/icons-material ``` </codeblock> These components use the Material UI `SvgIcon` component to render the SVG path for each icon, and so have a peer-dependency on `@mui/material`. If you aren't already using Material UI in your project, you can add it following the [installation guide](/material-ui/getting-started/installation/). ### Usage Import icons using one of these two options: - Option 1: ```jsx import AccessAlarmIcon from '@mui/icons-material/AccessAlarm'; import ThreeDRotation from '@mui/icons-material/ThreeDRotation'; ``` - Option 2: ```jsx import { AccessAlarm, ThreeDRotation } from '@mui/icons-material'; ``` The safest for bundle size is Option 1, but some developers prefer Option 2. Make sure you follow the [minimizing bundle size guide](/material-ui/guides/minimizing-bundle-size/#option-two-use-a-babel-plugin) before using the second approach. Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two-tone, and Sharp. To import the icon component with a theme other than the default, append the theme name to the icon name. For example `@mui/icons-material/Delete` icon with: - Filled theme (default) is exported as `@mui/icons-material/Delete`, - Outlined theme is exported as `@mui/icons-material/DeleteOutlined`, - Rounded theme is exported as `@mui/icons-material/DeleteRounded`, - Twotone theme is exported as `@mui/icons-material/DeleteTwoTone`, - Sharp theme is exported as `@mui/icons-material/DeleteSharp`. :::warning The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@mui/icons-material` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. ::: {{"demo": "SvgMaterialIcons.js"}} ### Testing For testing purposes, each icon exposed from `@mui/icons-material` has a `data-testid` attribute with the name of the icon. For instance: ```jsx import DeleteIcon from '@mui/icons-material/Delete'; ``` has the following attribute once mounted: ```html <svg data-testid="DeleteIcon"></svg> ``` ## SvgIcon If you need a custom SVG icon (not available in the [Material Icons](/material-ui/material-icons/)) you can use the `SvgIcon` wrapper. This component extends the native `<svg>` element: - It comes with built-in accessibility. - SVG elements should be scaled for a 24x24px viewport so that the resulting icon can be used as is, or included as a child for other Material UI components that use icons. This can be customized with the `viewBox` attribute. To inherit the `viewBox` value from the original image, the `inheritViewBox` prop can be used. - By default, the component inherits the current color. Optionally, you can apply one of the theme colors using the `color` prop. - It supports `<svg>` element as a child so you can copy and paste your SVG directly to `SvgIcon` component. {{"demo": "SvgIconChildren.js"}} ### Color {{"demo": "SvgIconsColor.js"}} ### Size {{"demo": "SvgIconsSize.js"}} ### Component prop You can use the `SvgIcon` wrapper even if your icons are saved in the `.svg` format. [svgr](https://github.com/gregberge/svgr) has loaders to import SVG files and use them as React components. For example, with webpack: ```jsx // webpack.config.js { test: /\.svg$/, use: ['@svgr/webpack'], } // --- import StarIcon from './star.svg'; <SvgIcon component={StarIcon} inheritViewBox /> ``` It's also possible to use it with "url-loader" or "file-loader". This is the approach used by Create React App. ```jsx // webpack.config.js { test: /\.svg$/, use: ['@svgr/webpack', 'url-loader'], } // --- import { ReactComponent as StarIcon } from './star.svg'; <SvgIcon component={StarIcon} inheritViewBox /> ``` ### createSvgIcon The `createSvgIcon` utility component is used to create the [Material Icons](#material-icons). It can be used to wrap an `<svg>` element or an SVG path which is passed as a child to the [`SvgIcon`](#svgicon) component. ```jsx const HomeIcon = createSvgIcon( <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />, 'Home', ); // or with custom SVG const PlusIcon = createSvgIcon( <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="h-6 w-6" > <path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg>, 'Plus', ); ``` {{"demo": "CreateSvgIcon.js"}} ### Font Awesome If you find that there are layout issues when using FontAwesomeIcon from `@fortawesome/react-fontawesome`, you can try passing the Font Awesome SVG data directly to SvgIcon. Below is a comparison of the `FontAwesomeIcon` component and a wrapped `SvgIcon` component. {{"demo": "FontAwesomeSvgIconDemo.js"}} FontAwesomeIcon's `fullWidth` prop can also be used to approximate the correct dimensions, but it isn't perfect. ### Other libraries #### MDI [materialdesignicons.com](https://pictogrammers.com/library/mdi/) provides over 2,000 icons. For the wanted icon, copy the SVG `path` they provide, and use it as the child of the `SvgIcon` component, or with `createSvgIcon()`. Note: [mdi-material-ui](https://github.com/TeamWertarbyte/mdi-material-ui) has already wrapped each of these SVG icons with the `SvgIcon` component, so you don't have to do it yourself. ## Icon (Font icons) The `Icon` component will display an icon from any icon font that supports ligatures. As a prerequisite, you must include one, such as the [Material Icons font](https://google.github.io/material-design-icons/#icon-font-for-the-web) in your project. To use an icon simply wrap the icon name (font ligature) with the `Icon` component, for example: ```jsx import Icon from '@mui/material/Icon'; <Icon>star</Icon>; ``` By default, an Icon will inherit the current text color. Optionally, you can set the icon color using one of the theme color properties: `primary`, `secondary`, `action`, `error` & `disabled`. ### Font Material Icons `Icon` will by default set the correct base class name for the Material Icons font (filled variant). All you need to do is load the font, for instance, via Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> ``` {{"demo": "Icons.js"}} ### Custom font For other fonts, you can customize the baseline class name using the `baseClassName` prop. For instance, you can display two-tone icons with Material Design: ```jsx import Icon from '@mui/material/Icon'; <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons+Two+Tone" // Import the two tones MD variant ^^^^^^^^ />; ``` {{"demo": "TwoToneIcons.js"}} #### Global base class name Modifying the `baseClassName` prop for each component usage is repetitive. You can change the default prop globally with the theme ```js const theme = createTheme({ components: { MuiIcon: { defaultProps: { // Replace the `material-icons` default value. baseClassName: 'material-icons-two-tone', }, }, }, }); ``` Then, you can use the two-tone font directly: ```jsx <Icon>add_circle</Icon> ``` ### Font Awesome [Font Awesome](https://fontawesome.com/icons) can be used with the `Icon` component as follows: {{"demo": "FontAwesomeIcon.js"}} Note that the Font Awesome icons weren't designed like the Material Icons (compare the two previous demos). The fa icons are cropped to use all the space available. You can adjust for this with a global override: ```js const theme = createTheme({ components: { MuiIcon: { styleOverrides: { root: { // Match 24px = 3 * 2 + 1.125 * 16 boxSizing: 'content-box', padding: 3, fontSize: '1.125rem', }, }, }, }, }); ``` {{"demo": "FontAwesomeIconSize.js"}} ## Font vs. SVGs: Which approach to use? Both approaches work fine, however there are some subtle differences, especially in terms of performance and rendering quality. Whenever possible SVG is preferred as it allows code splitting, supports more icons, and renders faster and better. For more details, take a look at [why GitHub migrated from font icons to SVG icons](https://github.blog/2016-02-22-delivering-octicons-with-svg/). ## Accessibility Icons can convey all sorts of meaningful information, so it's important to ensure they are accessible where appropriate. There are two use cases you'll want to consider: - **Decorative icons** that are only being used for visual or branding reinforcement. If they were removed from the page, users would still understand and be able to use your page. - **Semantic icons** are ones that you're using to convey meaning, rather than just pure decoration. This includes icons without text next to them that are used as interactive controls — buttons, form elements, toggles, etc. ### Decorative icons If your icons are purely decorative, you're already done! The `aria-hidden=true` attribute is added so that your icons are properly accessible (invisible). ### Semantic icons #### Semantic SVG icons You should include the `titleAccess` prop with a meaningful value. The `role="img"` attribute and the `<title>` element are added so that your icons are correctly accessible. In the case of focusable interactive elements, for example when used with an icon button, you can use the `aria-label` prop: ```jsx import IconButton from '@mui/material/IconButton'; import SvgIcon from '@mui/material/SvgIcon'; // ... <IconButton aria-label="delete"> <SvgIcon> <path d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z" /> </SvgIcon> </IconButton>; ``` #### Semantic font icons You need to provide a text alternative that is only visible to assistive technologies. ```jsx import Box from '@mui/material/Box'; import Icon from '@mui/material/Icon'; import { visuallyHidden } from '@mui/utils'; // ... <Icon>add_circle</Icon> <Box component="span" sx={visuallyHidden}>Create a user</Box> ``` #### Reference - https://www.tpgi.com/using-aria-enhance-svg-accessibility/
2,568
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/CustomImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; import IconButton from '@mui/material/IconButton'; import StarBorderIcon from '@mui/icons-material/StarBorder'; function srcset(image, width, height, rows = 1, cols = 1) { return { src: `${image}?w=${width * cols}&h=${height * rows}&fit=crop&auto=format`, srcSet: `${image}?w=${width * cols}&h=${ height * rows }&fit=crop&auto=format&dpr=2 2x`, }; } export default function CustomImageList() { return ( <ImageList sx={{ width: 500, height: 450, // Promote the list into its own layer in Chrome. This costs memory, but helps keeping high FPS. transform: 'translateZ(0)', }} rowHeight={200} gap={1} > {itemData.map((item) => { const cols = item.featured ? 2 : 1; const rows = item.featured ? 2 : 1; return ( <ImageListItem key={item.img} cols={cols} rows={rows}> <img {...srcset(item.img, 250, 200, rows, cols)} alt={item.title} loading="lazy" /> <ImageListItemBar sx={{ background: 'linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, ' + 'rgba(0,0,0,0.3) 70%, rgba(0,0,0,0) 100%)', }} title={item.title} position="top" actionIcon={ <IconButton sx={{ color: 'white' }} aria-label={`star ${item.title}`} > <StarBorderIcon /> </IconButton> } actionPosition="left" /> </ImageListItem> ); })} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', featured: true, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', featured: true, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', }, ];
2,569
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/CustomImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; import IconButton from '@mui/material/IconButton'; import StarBorderIcon from '@mui/icons-material/StarBorder'; function srcset(image: string, width: number, height: number, rows = 1, cols = 1) { return { src: `${image}?w=${width * cols}&h=${height * rows}&fit=crop&auto=format`, srcSet: `${image}?w=${width * cols}&h=${ height * rows }&fit=crop&auto=format&dpr=2 2x`, }; } export default function CustomImageList() { return ( <ImageList sx={{ width: 500, height: 450, // Promote the list into its own layer in Chrome. This costs memory, but helps keeping high FPS. transform: 'translateZ(0)', }} rowHeight={200} gap={1} > {itemData.map((item) => { const cols = item.featured ? 2 : 1; const rows = item.featured ? 2 : 1; return ( <ImageListItem key={item.img} cols={cols} rows={rows}> <img {...srcset(item.img, 250, 200, rows, cols)} alt={item.title} loading="lazy" /> <ImageListItemBar sx={{ background: 'linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, ' + 'rgba(0,0,0,0.3) 70%, rgba(0,0,0,0) 100%)', }} title={item.title} position="top" actionIcon={ <IconButton sx={{ color: 'white' }} aria-label={`star ${item.title}`} > <StarBorderIcon /> </IconButton> } actionPosition="left" /> </ImageListItem> ); })} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', featured: true, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', featured: true, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', }, ];
2,570
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/MasonryImageList.js
import * as React from 'react'; import Box from '@mui/material/Box'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function MasonryImageList() { return ( <Box sx={{ width: 500, height: 450, overflowY: 'scroll' }}> <ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> </Box> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', }, ];
2,571
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/MasonryImageList.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function MasonryImageList() { return ( <Box sx={{ width: 500, height: 450, overflowY: 'scroll' }}> <ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> </Box> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', }, ];
2,572
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/MasonryImageList.tsx.preview
<ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList>
2,573
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/QuiltedImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; function srcset(image, size, rows = 1, cols = 1) { return { src: `${image}?w=${size * cols}&h=${size * rows}&fit=crop&auto=format`, srcSet: `${image}?w=${size * cols}&h=${ size * rows }&fit=crop&auto=format&dpr=2 2x`, }; } export default function QuiltedImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} variant="quilted" cols={4} rowHeight={121} > {itemData.map((item) => ( <ImageListItem key={item.img} cols={item.cols || 1} rows={item.rows || 1}> <img {...srcset(item.img, 121, item.rows, item.cols)} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', cols: 2, }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', cols: 2, }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', cols: 2, }, ];
2,574
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/QuiltedImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; function srcset(image: string, size: number, rows = 1, cols = 1) { return { src: `${image}?w=${size * cols}&h=${size * rows}&fit=crop&auto=format`, srcSet: `${image}?w=${size * cols}&h=${ size * rows }&fit=crop&auto=format&dpr=2 2x`, }; } export default function QuiltedImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} variant="quilted" cols={4} rowHeight={121} > {itemData.map((item) => ( <ImageListItem key={item.img} cols={item.cols || 1} rows={item.rows || 1}> <img {...srcset(item.img, 121, item.rows, item.cols)} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', cols: 2, }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', cols: 2, }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', cols: 2, }, ];
2,575
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/QuiltedImageList.tsx.preview
<ImageList sx={{ width: 500, height: 450 }} variant="quilted" cols={4} rowHeight={121} > {itemData.map((item) => ( <ImageListItem key={item.img} cols={item.cols || 1} rows={item.rows || 1}> <img {...srcset(item.img, 121, item.rows, item.cols)} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList>
2,576
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/StandardImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function StandardImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} cols={3} rowHeight={164}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=164&h=164&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', }, ];
2,577
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/StandardImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function StandardImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} cols={3} rowHeight={164}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=164&h=164&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', }, ];
2,578
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/StandardImageList.tsx.preview
<ImageList sx={{ width: 500, height: 450 }} cols={3} rowHeight={164}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=164&h=164&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList>
2,579
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarBelowImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; export default function TitlebarBelowImageList() { return ( <ImageList sx={{ width: 500, height: 450 }}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar title={item.title} subtitle={<span>by: {item.author}</span>} position="below" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', }, ];
2,580
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarBelowImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; export default function TitlebarBelowImageList() { return ( <ImageList sx={{ width: 500, height: 450 }}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar title={item.title} subtitle={<span>by: {item.author}</span>} position="below" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', }, ];
2,581
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarBelowMasonryImageList.js
import * as React from 'react'; import Box from '@mui/material/Box'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; export default function TitlebarBelowMasonryImageList() { return ( <Box sx={{ width: 500, height: 450, overflowY: 'scroll' }}> <ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar position="below" title={item.author} /> </ImageListItem> ))} </ImageList> </Box> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', author: 'swabdesign', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', author: 'Pavel Nekoranec', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', author: 'Charles Deluvio', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', author: 'Christian Mackie', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', author: 'Darren Richardson', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', author: 'Taylor Simpson', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', author: 'Ben Kolde', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', author: 'Philipp Berndt', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', author: 'Jen P.', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', author: 'Douglas Sheppard', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', author: 'Fi Bell', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', author: 'Hutomo Abrianto', }, ];
2,582
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarBelowMasonryImageList.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; export default function TitlebarBelowMasonryImageList() { return ( <Box sx={{ width: 500, height: 450, overflowY: 'scroll' }}> <ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar position="below" title={item.author} /> </ImageListItem> ))} </ImageList> </Box> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', author: 'swabdesign', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', author: 'Pavel Nekoranec', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', author: 'Charles Deluvio', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', author: 'Christian Mackie', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', author: 'Darren Richardson', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', author: 'Taylor Simpson', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', author: 'Ben Kolde', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', author: 'Philipp Berndt', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', author: 'Jen P.', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', author: 'Douglas Sheppard', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', author: 'Fi Bell', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', author: 'Hutomo Abrianto', }, ];
2,583
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarBelowMasonryImageList.tsx.preview
<ImageList variant="masonry" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar position="below" title={item.author} /> </ImageListItem> ))} </ImageList>
2,584
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; import ListSubheader from '@mui/material/ListSubheader'; import IconButton from '@mui/material/IconButton'; import InfoIcon from '@mui/icons-material/Info'; export default function TitlebarImageList() { return ( <ImageList sx={{ width: 500, height: 450 }}> <ImageListItem key="Subheader" cols={2}> <ListSubheader component="div">December</ListSubheader> </ImageListItem> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar title={item.title} subtitle={item.author} actionIcon={ <IconButton sx={{ color: 'rgba(255, 255, 255, 0.54)' }} aria-label={`info about ${item.title}`} > <InfoIcon /> </IconButton> } /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', rows: 2, cols: 2, featured: true, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', cols: 2, }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', cols: 2, }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', rows: 2, cols: 2, featured: true, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', cols: 2, }, ];
2,585
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/TitlebarImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; import ImageListItemBar from '@mui/material/ImageListItemBar'; import ListSubheader from '@mui/material/ListSubheader'; import IconButton from '@mui/material/IconButton'; import InfoIcon from '@mui/icons-material/Info'; export default function TitlebarImageList() { return ( <ImageList sx={{ width: 500, height: 450 }}> <ImageListItem key="Subheader" cols={2}> <ListSubheader component="div">December</ListSubheader> </ImageListItem> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=248&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=248&fit=crop&auto=format`} alt={item.title} loading="lazy" /> <ImageListItemBar title={item.title} subtitle={item.author} actionIcon={ <IconButton sx={{ color: 'rgba(255, 255, 255, 0.54)' }} aria-label={`info about ${item.title}`} > <InfoIcon /> </IconButton> } /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e', title: 'Breakfast', author: '@bkristastucchio', rows: 2, cols: 2, featured: true, }, { img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d', title: 'Burger', author: '@rollelflex_graphy726', }, { img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45', title: 'Camera', author: '@helloimnik', }, { img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c', title: 'Coffee', author: '@nolanissac', cols: 2, }, { img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8', title: 'Hats', author: '@hjrc33', cols: 2, }, { img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62', title: 'Honey', author: '@arwinneil', rows: 2, cols: 2, featured: true, }, { img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6', title: 'Basketball', author: '@tjdragotta', }, { img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f', title: 'Fern', author: '@katie_wasserman', }, { img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25', title: 'Mushrooms', author: '@silverdalex', rows: 2, cols: 2, }, { img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af', title: 'Tomato basil', author: '@shelleypauls', }, { img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1', title: 'Sea star', author: '@peterlaster', }, { img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6', title: 'Bike', author: '@southside_customs', cols: 2, }, ];
2,586
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/WovenImageList.js
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function WovenImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} variant="woven" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=161&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=161&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', }, ];
2,587
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/WovenImageList.tsx
import * as React from 'react'; import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; export default function WovenImageList() { return ( <ImageList sx={{ width: 500, height: 450 }} variant="woven" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=161&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=161&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList> ); } const itemData = [ { img: 'https://images.unsplash.com/photo-1549388604-817d15aa0110', title: 'Bed', }, { img: 'https://images.unsplash.com/photo-1563298723-dcfebaa392e3', title: 'Kitchen', }, { img: 'https://images.unsplash.com/photo-1523413651479-597eb2da0ad6', title: 'Sink', }, { img: 'https://images.unsplash.com/photo-1525097487452-6278ff080c31', title: 'Books', }, { img: 'https://images.unsplash.com/photo-1574180045827-681f8a1a9622', title: 'Chairs', }, { img: 'https://images.unsplash.com/photo-1597262975002-c5c3b14bbd62', title: 'Candle', }, { img: 'https://images.unsplash.com/photo-1530731141654-5993c3016c77', title: 'Laptop', }, { img: 'https://images.unsplash.com/photo-1481277542470-605612bd2d61', title: 'Doors', }, { img: 'https://images.unsplash.com/photo-1517487881594-2787fef5ebf7', title: 'Coffee', }, { img: 'https://images.unsplash.com/photo-1516455207990-7a41ce80f7ee', title: 'Storage', }, { img: 'https://images.unsplash.com/photo-1519710164239-da123dc03ef4', title: 'Coffee table', }, { img: 'https://images.unsplash.com/photo-1588436706487-9d55d73a39e3', title: 'Blinds', }, ];
2,588
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/WovenImageList.tsx.preview
<ImageList sx={{ width: 500, height: 450 }} variant="woven" cols={3} gap={8}> {itemData.map((item) => ( <ImageListItem key={item.img}> <img srcSet={`${item.img}?w=161&fit=crop&auto=format&dpr=2 2x`} src={`${item.img}?w=161&fit=crop&auto=format`} alt={item.title} loading="lazy" /> </ImageListItem> ))} </ImageList>
2,589
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/image-list.md
--- productId: material-ui title: Image List React component components: ImageList, ImageListItem, ImageListItemBar materialDesign: https://m2.material.io/components/image-lists githubLabel: 'component: image list' --- # Image List <p class="description">The Image List displays a collection of images in an organized grid.</p> Image lists represent a collection of items in a repeated pattern. They help improve the visual comprehension of the content they hold. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Standard image list Standard image lists are best for items of equal importance. They have a uniform container size, ratio, and spacing. {{"demo": "StandardImageList.js"}} ## Quilted image list Quilted image lists emphasize certain items over others in a collection. They create hierarchy using varied container sizes and ratios. {{"demo": "QuiltedImageList.js"}} ## Woven image list Woven image lists use alternating container ratios to create a rhythmic layout. A woven image list is best for browsing peer content. {{"demo": "WovenImageList.js"}} ## Masonry image list Masonry image lists use dynamically sized container heights that reflect the aspect ratio of each image. This image list is best used for browsing uncropped peer content. {{"demo": "MasonryImageList.js"}} ## Image list with title bars This example demonstrates the use of the `ImageListItemBar` to add an overlay to each item. The overlay can accommodate a `title`, `subtitle` and secondary action - in this example an `IconButton`. {{"demo": "TitlebarImageList.js"}} ### Title bar below image (standard) The title bar can be placed below the image. {{"demo": "TitlebarBelowImageList.js"}} ### Title bar below image (masonry) {{"demo": "TitlebarBelowMasonryImageList.js"}} ## Custom image list In this example the items have a customized titlebar, positioned at the top and with a custom gradient `titleBackground`. The secondary action `IconButton` is positioned on the left. The `gap` prop is used to adjust the gap between items. {{"demo": "CustomImageList.js", "defaultCodeOpen": false}}
2,590
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/itemData.d.ts
export interface ItemDataItem { img: string; title: string; author: string; cols: number; featured: boolean; } declare const itemData: ItemDataItem[]; export default itemData;
2,591
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/image-list/tslint.json
{ "extends": "../../../tslint.json", "rules": { "no-relative-import-in-test": false } }
2,592
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/ButtonLink.js
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Link from '@mui/material/Link'; export default function ButtonLink() { return ( <Link component="button" variant="body2" onClick={() => { console.info("I'm a button."); }} > Button Link </Link> ); }
2,593
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/ButtonLink.tsx
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Link from '@mui/material/Link'; export default function ButtonLink() { return ( <Link component="button" variant="body2" onClick={() => { console.info("I'm a button."); }} > Button Link </Link> ); }
2,594
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/ButtonLink.tsx.preview
<Link component="button" variant="body2" onClick={() => { console.info("I'm a button."); }} > Button Link </Link>
2,595
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/Links.js
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; const preventDefault = (event) => event.preventDefault(); export default function Links() { return ( <Box sx={{ typography: 'body1', '& > :not(style) ~ :not(style)': { ml: 2, }, }} onClick={preventDefault} > <Link href="#">Link</Link> <Link href="#" color="inherit"> {'color="inherit"'} </Link> <Link href="#" variant="body2"> {'variant="body2"'} </Link> </Box> ); }
2,596
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/Links.tsx
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; const preventDefault = (event: React.SyntheticEvent) => event.preventDefault(); export default function Links() { return ( <Box sx={{ typography: 'body1', '& > :not(style) ~ :not(style)': { ml: 2, }, }} onClick={preventDefault} > <Link href="#">Link</Link> <Link href="#" color="inherit"> {'color="inherit"'} </Link> <Link href="#" variant="body2"> {'variant="body2"'} </Link> </Box> ); }
2,597
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/Links.tsx.preview
<Link href="#">Link</Link> <Link href="#" color="inherit"> {'color="inherit"'} </Link> <Link href="#" variant="body2"> {'variant="body2"'} </Link>
2,598
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/links/UnderlineLink.js
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; const preventDefault = (event) => event.preventDefault(); export default function UnderlineLink() { return ( <Box sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', typography: 'body1', '& > :not(style) ~ :not(style)': { ml: 2, }, }} onClick={preventDefault} > <Link href="#" underline="none"> {'underline="none"'} </Link> <Link href="#" underline="hover"> {'underline="hover"'} </Link> <Link href="#" underline="always"> {'underline="always"'} </Link> </Box> ); }
2,599