Utils Material Grid Example
src / Demo.tsx
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import React, { ReactElement } from "react";
import cn from "classnames";
import { Grid, GridCell } from "@react-md/utils";
import styles from "./Grid.module.scss";
export default function GridExample(): ReactElement {
return (
<>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 12 }, (_, i) => (
<GridCell key={i} className={styles.item}>{`Cell ${i + 1}`}</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 6 }, (_, i) => (
<GridCell key={i} className={styles.item} colSpan={2}>
{`Cell ${i + 1}`}
</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 8 }, (_, i) => (
<GridCell key={i} className={styles.item} colSpan={3}>
{`Cell ${i + 1}`}
</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 3 }, (_, i) => (
<GridCell key={i} className={styles.item} colSpan={4}>
{`Cell ${i + 1}`}
</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 2 }, (_, i) => (
<GridCell key={i} className={styles.item} colSpan={5}>
{`Cell ${i + 1}`}
</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
{Array.from({ length: 2 }, (_, i) => (
<GridCell key={i} className={styles.item} colSpan={6}>
{`Cell ${i + 1}`}
</GridCell>
))}
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={7}>
Cell 1
</GridCell>
<GridCell className={styles.item} colSpan={5}>
Cell 2
</GridCell>
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={8}>
Cell 1
</GridCell>
<GridCell className={styles.item} colSpan={4}>
Cell 2
</GridCell>
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={9}>
Cell 1
</GridCell>
<GridCell className={styles.item} colSpan={3}>
Cell 2
</GridCell>
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={10}>
Cell 1
</GridCell>
<GridCell className={styles.item} colSpan={2}>
Cell 2
</GridCell>
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={11}>
Cell 1
</GridCell>
<GridCell className={styles.item}>Cell 2</GridCell>
</Grid>
<Grid className={cn(styles.grid, styles.smallGrid)}>
<GridCell className={styles.item} colSpan={12}>
Cell 1
</GridCell>
</Grid>
</>
);
}