@s-ui/react-layout-grid

2.15.0 • Public • Published

LayoutGrid

The layout grid component adapts to screen size (responsive), ensuring consistency across layouts. The grid creates visual consistency between layouts while allowing flexibility across a wide variety of designs. Based on our design principles, this component is based on a 12 columns grid layout.

Installation

$ npm install @s-ui/react-layout-grid

Usage

  • This component uses CSS Flexbox for high flexibility (Support for CSS grid? Would be great 😉).
  • There are two types of layout: <LayoutGrid /> and your items <LayoutGridItem />.
  • Item widths are set in percentages, so they’re always fluid and sized relative to their parent element.
  • Items have padding to create the spacing between individual items.
  • The breakpoints is defined on sui-theme: xxs | xs | s | m | l | xl | xxl

Basic usage

Import package and use the component

import LayoutGrid from '@s-ui/react-layout-grid'

return <LayoutGrid />

Default

<LayoutGrid>
  <LayoutGridItem colSpan={4}>...</LayoutGridItem>
  <LayoutGridItem colSpan={8}>...</LayoutGridItem>
</LayoutGrid>

With breakpooints

<LayoutGrid>
  <LayoutGridItem xxs={1} s={4} m={2} xl={6}>
    ...
  </LayoutGridItem>
  <LayoutGridItem xxs={1} s={8} m={10} xl={6}>
    ...
  </LayoutGridItem>
</LayoutGrid>

With alignItems and justifyContent and alignContent props

<LayoutGrid
  alignItems="center"
  justifyContent="space-around"
  alignContent="stretch"
>
  <LayoutGridItem s={4} xl={6}>
    ...
  </LayoutGridItem>
  <LayoutGridItem s={8} xl={6}>
    ...
  </LayoutGridItem>
</LayoutGrid>

With cells offset

<LayoutGrid>
  <LayoutGridItem s={6} sOffset={3} xl={10} xlOffset={1}>
    ...
  </LayoutGridItem>
</LayoutGrid>

Import the styles (Sass)

@import '~@s-ui/theme/lib/index';
// @import 'your theme';
@import '~@s-ui/react-layout-grid/lib/index';

Find full description and more examples in the demo page.

Dependents (27)

Package Sidebar

Install

npm i @s-ui/react-layout-grid

Weekly Downloads

1,401

Version

2.15.0

License

MIT

Unpacked Size

14.7 kB

Total Files

11

Last publish

Collaborators

  • alejandro.ferrante
  • ivanmlaborda
  • salvador.juan
  • andresin87.adevinta
  • izeller
  • gfabregoadv
  • a.ferrer
  • ignacio_navarro
  • oscar_ramirez
  • jordi.munoz
  • joanleon-adv
  • aitor.rodriguez
  • luis-garrido
  • jenifer.lopez
  • isabelgomez87
  • pa.chruscinski.ext
  • schibstedspain
  • alfredo.arronte
  • belen.santos
  • xavi_ballestar
  • ferrangbtw
  • jamile.radloff
  • davidmartin2108
  • sergi.quintela
  • estefania_garcia
  • carlosvillu-adevinta
  • miriam-gil
  • arnau.guell
  • ferran.simon
  • victor.perez.adevinta
  • mariapaula.forero.ext
  • oscar.gomez
  • david.nieto
  • oriol.puig
  • nacho_torrella
  • xavi.murcia
  • ignacio.rodriguez
  • javier.miguel
  • francisco.ruiz.lloret
  • sziauberyte
  • alfredo.zimperz
  • andresadv
  • javiauso
  • alverd004
  • marian.lucaci
  • pablogs
  • alisa_bayanova
  • cristhianb
  • sergiocollado
  • pablo.rey-adevinta
  • beatrizip
  • alex.castells
  • david.cuadrado.ext
  • giovanny.sayas.ext
  • patricio.sartore
  • azahara
  • marc.benito
  • sergio.escano
  • cristina.rodriguez.duque
  • pol.valls
  • frandelacasa-adevinta
  • carolina.mallo.ext
  • daniel.perez.ext
  • hpintos_adevinta
  • carlos.gonzalezl
  • albert.peiro
  • oscar-raig-adevinta
  • thomas.page.ext
  • sebastian.badea.adevinta
  • victoria.pasichnyk.ext
  • sendami.luque.ext
  • luz_adv
  • alfredo.narvaez
  • ruben-martin
  • dann41
  • emiliovz
  • adria.velardos
  • arturo.vicente
  • diegomr
  • sergi.martinez.adevinta
  • guillemgc3