Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@input-output-hk/react-grid

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@input-output-hk/react-grid

Bootstrap inspired React responsive grid

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

React Grid

A modern lightweight React grid layout library inspired by Bootstrap

🚀 DEMO 🚀

React Grid issues Fork React Grid React Grid stars React Grid license CircleCI build Test coverage


Contents

  1. Install
  2. Dependencies
  3. Quick start
  4. API
  5. Contributing

Install

npm i --save @input-output-hk/react-grid

or

yarn add @input-output-hk/react-grid

Dependencies

Quick start

Add the provider to your top level component (See React context API docs for more info)

import { Provider } from '@input-output-hk/react-grid'

...

export default () => (
  <Provider>
    ...
    <MyApp />
    ...
  </Provider>
)

Use the grid under the Provider tree

import { Grid, Row, Column } from '@input-output-hk/react-grid'

...

export default () => (
  <Grid>
    <Row sm={1}>
      <Column>Column 1 content</Column>
      <Column>Column 2 content</Column>
    </Row>
  </Grid>
)

The example above will render a grid with 2 columns of equal width, when the screen width reaches the sm breakpoint there will be two rows with a single column

API

Grid

Each grid layout starts with the Grid component. The Grid must contain at least one child Row component. No other component types should be child components of a Grid.

PROPTYPEDEFAULT VALUEREQUIREDDESCRIPTION
fillRowsbooleanfalsefalseWhen a maximum amount of columns is specified on a row, but there are not enough columns to fill that row, enabling fillRows will add empty columns.
spacingnumber0falseAdds vertical padding to the grid component in rem units
styleobjectnullfalseReact style object
classNamestringnullfalseReact className
childrenReactNodenulltrueChild components, either a single node or array of nodes. Each node must be a Row component

Row

Each Row component must be a direct child of a Grid. Each Row should have at least one Column child component. No other component types should be child components of a Row.

PROPTYPEDEFAULT VALUEREQUIREDDESCRIPTION
spacingnumber0falseVertical padding applied to the row, in rem units.
columnSpacingnumber0falseHorizontal padding applied to each column, in rem units. Columns can individually override this value.
xlnumbernullfalseThe amount of columns per row on xl screen widths.
lgnumbernullfalseThe amount of columns per row on lg screen widths. Inherits from xl.
mdnumbernullfalseThe amount of columns per row on md screen widths. Inherits from lg.
smnumbernullfalseThe amount of columns per row on sm screen widths. Inherits from md.
xsnumbernullfalseThe amount of columns per row on xs screen widths. Inherits from sm.

Any props not listed in the table are automatically added.

Column

Each Column component must be a direct child of a Row. Columns can contain anything, even more grids.

PROPTYPEDEFAULT VALUEREQUIREDDESCRIPTION
sizenumber1falseThe size value applied as flex
spacingnumber0falseHorizontal padding applied to the column, in rem units.
verticalAlignstringnullfalseOne of top, center or bottom. How to vertically align content within column relative to the row
xlOffsetnumber0falseHow many columns to offset on xl screen widths.
lgOffsetnumber0falseHow many columns to offset on lg screen widths. Inherits from xl.
mdOffsetnumber0falseHow many columns to offset on md screen widths. Inherits from lg.
smOffsetnumber0falseHow many columns to offset on sm screen widths. Inherits from md.
xsOffsetnumber0falseHow many columns to offset on xs screen widths. Inherits from sm.

Any props not listed in the table are automatically added.

Provider

The provider state component comes from the React context API and is used to set the screen width breakpoints.

PROPTYPEDEFAULT VALUEREQUIREDDESCRIPTION
childrenReactNodenulltrueChildren to render under the provider tree
screenSizesobjectnullfalseObject containing the screen sizes. See the screen sizes schema for details.
Screen sizes schema
KEYTYPEDEFAULT VALUEREQUIREDDESCRIPTION
xlnumber1200falseAnything greater than this number (included) is an xl screen
lgnumber992falseAnything between this number (included) and xl is an lg screen
mdnumber768falseAnything between this number (included) and lg is an md screen
smnumber576falseAnything less than this is xs, anything between this number (included) and md is an sm screen

Contributing

Contributions are welcome, see contributing for more info.

Keywords

FAQs

Package last updated on 15 Aug 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc