Socket
Book a DemoInstallSign in
Socket

@commercetools-uikit/grid

Package Overview
Dependencies
Maintainers
3
Versions
810
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/grid

The Grid component can be used to implement layouts using CSS-Grid.

latest
Source
npmnpm
Version
20.2.3
Version published
Maintainers
3
Created
Source

Grid

Description

The Grid component can be used to implement layouts using CSS-Grid.

CSS Grid Layout is the most powerful layout system available in CSS. It is a 2-dimensional system, meaning it can handle both columns and rows, unlike flexbox which is largely a 1-dimensional system. You work with Grid Layout by applying CSS rules both to a parent element (which becomes the Grid Container) and to that elements children (which become Grid Items).

The component accepts all the supported properties of CSS Grid, both for the parent container and the children elements (<Grid.Item>).

Installation

yarn add @commercetools-uikit/grid
npm --save install @commercetools-uikit/grid

Additionally install the peer dependencies (if not present)

yarn add react
npm --save install react

Usage

import Grid from '@commercetools-uikit/grid';

/**
 * We also recommend having a look at the [Grid story examples](https://uikit.commercetools.com/?path=/story/examples-components-grid--with-fixed-columns)
 * to see more detailed examples of common use cases of the CSS Grid layout.
 **/
const Example = () => (
  <Grid
    gridGap="16px"
    gridAutoColumns="1fr"
    gridTemplateColumns="repeat(3, 1fr)"
  >
    <Grid.Item>{'1'}</Grid.Item>
    <Grid.Item>{'2'}</Grid.Item>
    <Grid.Item>{'3'}</Grid.Item>
    <Grid.Item>{'4'}</Grid.Item>
    <Grid.Item>{'5'}</Grid.Item>
  </Grid>
);

export default Example;

Properties

PropsTypeRequiredDefaultDescription
childrenReactNode
displayunion
Possible values:
'grid' , 'inline-grid'
'grid'
gridTemplateColumnsstring
gridTemplateRowsstring
gridTemplateAreasstring
gridTemplatestring
gridColumnGapstring
gridRowGapstring
gridGapstring
justifyItemsunion
Possible values:
'start' , 'end' , 'center' , 'stretch'
alignItemsunion
Possible values:
'start' , 'end' , 'center' , 'stretch'
placeItemsunion
Possible values:
'start' , 'end' , 'center' , 'stretch'
justifyContentunion
Possible values:
, 'start', 'end', 'center', 'stretch', 'space-around', 'space-between', 'space-evenly'
alignContentunion
Possible values:
, 'start', 'end', 'center', 'stretch', 'space-around', 'space-between', 'space-evenly'
placeContentunion
Possible values:
, 'start', 'end', 'center', 'stretch', 'space-around', 'space-between', 'space-evenly'
gridAutoColumnsstring
gridAutoRowsstring
gridAutoFlowstring
gridstring

The component accepts all supported CSS Grid properties, as listed here, in camelCase format

Keywords

javascript

FAQs

Package last updated on 07 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts