Twigs Logo

Grid

A div that comes with CSS Grid properties for easy layout management and responsive design.

Import

import { Grid } from "@sparrowengg/twigs-react";

Usage

const GridExample = () => {
  return (
    <Grid width={200} gap={[16, 16]} css={{ padding: "$4" }}>
      <Box css={{ padding: "$4", background: "$primary200", borderRadius: "$md" }}>
        Grid Item 1
      </Box>
      <Box css={{ padding: "$4", background: "$secondary200", borderRadius: "$md" }}>
        Grid Item 2
      </Box>
      <Box css={{ padding: "$4", background: "$accent200", borderRadius: "$md" }}>
        Grid Item 3
      </Box>
      <Box css={{ padding: "$4", background: "$neutral200", borderRadius: "$md" }}>
        Grid Item 4
      </Box>
    </Grid>
  );
};

Props

Grid

PropTypeDefault
width?
number
-
templateColumns?
string
-
templateRows?
string
-
templateAreas?
string
-
gap?
Array<string | number>
[3, 3]
repeat?
'fit' | 'fill'
'fit'
children?
ReactNode
-
css?
object
-