grid

Basic usage

import {Grid} from "tuix-design"
copy

Simple Grid

Column props define de number of grid's column.

<Grid column={3}>
    <Box bg="blue" height={100} />
    <Box bg="blue" height={100} />
    <Box bg="blue" height={100} />
    <Box bg="blue" height={100} />
</Grid>
copy

Autorows set all grid's child height.

<Grid column={3} autoRows={100}>
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
</Grid>
copy

AutoCols sets a size for the columns in a grid.It affects only columns with the size not set

<Grid column={3} autoRows={100}>
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
</Grid>
copy

templateColumns

<Grid templateColumns="20px 100px 200px" autoRows={100}>
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
</Grid>
copy

templateRows

<Grid templateRows="100px 50px 20px">
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
</Grid>
copy

gap

<Grid column={3} autoRows={100} gap={20}>
    <Box bg="blue" />
    <Box bg="blue" />
    <Box bg="blue" />
</Grid>
copy

Grid Item

<Grid templateColumns="auto auto auto">
<GridItem col="1 / 3">
            <Box bg="red" height={100} />
    </GridItem>
<GridItem>
            <Box bg="blue" height={100} />
</GridItem>
    <GridItem>
            <Box bg="blue" height={100} />
    </GridItem>
</Grid>
copy

Grid Area

<Grid templateAreas='"red blue" "green green"'>
<GridItem area="red">
<Box bg="red" height={100} />
</GridItem>
<GridItem area="blue">
<Box bg="blue" height={100} />
</GridItem>
<GridItem area="green">
<Box bg="green" height={100} />
</GridItem>
</Grid>
copy

Grid props

propstypestatusdefaultdescription
columnnumberoptional1Grid column number
templateColumnsstring | numberoptionalnullThe number (and the widths) of columns in a grid layout
templateRowsstring | numberoptionalnullThe number (and the heights) of the rows in a grid layout
autoRowsstring | numberoptionalnullRows's size
autoColsstring | numberoptionalnullColumns's size
templateAreasstringoptionalnullareas within the grid layout
gapnumberoptional5the gap between the rows/Columns in a grid layout

Grid Item props

propstypestatusdefaultdescription
gridColumnstring | numberoptionalnullgrid item's size and location in a grid layout
gridRowstring | numberoptionalnullgrid item's size and location in a grid layout
gridAreastring | numberoptionalnullgrid item's size and location in a grid layout
basicsimple gridtemplateColumnstemplateRowsgapgrid itemgrid areagrid apigrid item api