Socket
Socket
Sign inDemoInstall

@commercetools-uikit/grid

Package Overview
Dependencies
5
Maintainers
3
Versions
582
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
8.7K
increased by40.61%
Maintainers
3
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 17 Apr 2024

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc