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

react-bem-grid

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-bem-grid

[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url]

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
2
Weekly downloads
 
Created
Source

React BEM Grid

NPM version Build Status Coveralls Status Dependency Status

A BEM-ified port of Flexbox Grid to a simple, reusable React component.

NPM

npm install --save react-bem-grid

Usage

import React from 'react';
import { Grid, Row, Col } from 'react-bem-grid';

class GridExample extends React.Component {
  render() {
    return (
      <Grid>
        <Row>
          <Col xs={12} sm={6} lg={4}>
            ...
          </Col>
          <Col xs={12} sm={6} lg={4}>
            ...
          </Col>
          <Col xs={12} sm={6} lg={4}>
            ...
          </Col>
        </Row>
      </Grid>
    );
  }
}

Documentation

Responsive

Responsive modifiers enable specifying different column sizes, offsets, alignment and distribution at xs, sm, md & lg viewport widths.

<Grid>
  <Row>
    <Col xs={12} sm={8} md={6} lg={4}>
      ...
    </Col>
  </Row>
</Grid>

Offsets

Offset a column.

<Grid>
  <Row>
    <Col xs={8} xsOffset={4} sm={6} smOffset={6} lg={12}>
      ...
    </Col>
  </Row>
</Grid>

Auto Width

Add any number of auto sizing columns to a row. Let the grid figure it out.

<Grid>
  <Row>
    <Col xs>
      ...
    </Col>
    <Col xs>
      ...
    </Col>
    <Col xs>
      ...
    </Col>
  </Row>
</Grid>

Nested Grids

Nest grids inside grids inside grids.

<Grid>
  <Row>
    <Col xs={12}>
      <Row>
        <Col xs={6}>
          <Row>
            <Col xs={4}>
              ...
            </Col>
            <Col xs={4}>
              ...
            </Col>
            <Col xs={4}>
              ...
            </Col>
          </Row>
        </Col>
        <Col xs={6}>
        <Row>
          <Col xs={6}>
            ...
          </Col>
          <Col xs={6}>
            ...
          </Col>
        </Row>
        </Col>
      </Row>
    </Col>
  </Row>
</Grid>

Custom Element Type

Add the componentClass property to override the default element type of a Grid, Row or Col.

<Grid>
  <Row componentClass='nav'>
    <Col xs={6}>
      ...
    </Col>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>

Alignment

Add properties to align elements to the start or end of a row as well as the top, bottom, or center of a column.

Start
<Grid>
  <Row xsStart>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>
Center
<Grid>
  <Row xsCenter>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>
End
<Grid>
  <Row xsEnd>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>

Here is an example of using the modifiers in conjunction to achieve different alignment at different viewport sizes.

<Grid>
  <Row xsCenter smEnd lgStart>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>
Top
<Grid>
  <Row xsTop>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>
Middle
<Grid>
  <Row xsMiddle>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>
Bottom
<Grid>
  <Row xsBottom>
    <Col xs={6}>
      ...
    </Col>
  </Row>
</Grid>

Distribution

Add properties to distribute the contents of a row or column.

Around
<Grid>
  <Row xsAround>
    <Col xs={2}>
      ...
    </Col>
    <Col xs={2}>
      ...
    </Col>
    <Col xs={2}>
      ...
    </Col>
  </Row>
</Grid>
Between
<Grid>
  <Row xsBetween>
    <Col xs={2}>
      ...
    </Col>
    <Col xs={2}>
      ...
    </Col>
    <Col xs={2}>
      ...
    </Col>
  </Row>
</Grid>

Reordering

Add properties to reorder columns.

First
<Grid>
  <Row>
    <Col xs={4}>
      1
    </Col>
    <Col xs={4}>
      2
    </Col>
    <Col xs={4} xsFirst>
      3
    </Col>
  </Row>
</Grid>
Last
<Grid>
  <Row>
    <Col xs={4} xsLast>
      1
    </Col>
    <Col xs={4}>
      2
    </Col>
    <Col xs={4}>
      3
    </Col>
  </Row>
</Grid>

Reversing

<Grid>
  <Row reverse>
    <Col xs={4}>
      1
    </Col>
    <Col xs={4}>
      2
    </Col>
    <Col xs={4}>
      3
    </Col>
  </Row>
</Grid>

Example project

First, clone react-bem-grid, install dependencies and build the project:

git clone https://github.com/nordnet/react-bem-grid.git
npm install
npm run build

Then run the simple-grid example project:

cd examples/simple-grid
npm install
npm start

License

MIT © Nordnet Bank AB

Keywords

FAQs

Package last updated on 11 Aug 2015

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