Installation
Section titled “Installation”- Package
@bigbang/ui- Import
import { Grid } from '@bigbang/ui';- Source
- Grid.tsx
- Storybook
- Grid · Playground
Grid is in the @bigbang/ui package. Installation and style files are the same as for Button; for details, see the Button code tab.
import { Grid } from '@bigbang/ui';
<Grid columns={{ base: 1, md: 2, lg: 3 }} gap="lg"> <Grid.Item>First item</Grid.Item> <Grid.Item span={{ base: 'full', md: 1 }}>Second item</Grid.Item></Grid>;columns- Description
- Number of equal columns, or one count per breakpoint:
basebelow 1024 px,mdfrom 1024 px,lgfrom 1440 px, such as{ base: 1, md: 2, lg: 3 }. A breakpoint without a value keeps the smaller one. - Type
Responsive<GridColumns>- Default
1
gap- Description
- Space between columns and rows, from the
space.*scale. - Type
SpaceToken- Default
'lg'
render- Description
- Renders another element, such as
<ul>or<section>. Defaults to a<div>. - Type
ReactElement | ComponentRenderFn<HTMLProps, {}>
className- Description
- For layout only: width, margins, placement in a parent grid.
- Type
string
children- Description
- Grid items, usually
Grid.Item. - Type
ReactNode
The props of Grid.Item are span, render and className; the table above shows those of Grid. Native <div> attributes are passed through. ref is attached to the rendered element.
Data attributes
Section titled “Data attributes”data-component="grid": on the Grid root element.data-part="item": on Grid.Item.