FormidableLabs/radium-grid

Name: radium-grid

Owner: Formidable

Description: A powerful, no-fuss grid system component for React

Created: 2016-01-07 18:41:22.0

Updated: 2017-12-04 17:12:50.0

Pushed: 2017-06-06 17:35:09.0

Homepage:

Size: 1879

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Radium Grid Build Status Coverage Status

Radium Grid is a powerful, no-fuss grid system component for React. It combines the best decisions from the ecosystem of (S)CSS-based grid systems and implements them hack-free on top of Flexbox.

What makes Radium Grid special?
Prerelease

Although this is prerelease software, we'll do our best to avoid breaking public API changes.

Installation

npm install --save radium-grid

Usage
rt { Grid, Cell } from 'radium-grid';

t App = () => {
turn (
<Grid>
  <Cell>
    <p>Lorem</p>
  </Cell>
  <Cell>
    <p>ipsum</p>
  </Cell>
  <Cell>
    <p>dolor</p>
  </Cell>
  <Cell>
    <p>sit</p>
  </Cell>
</Grid>


The above example will render with the following provided defaults:

To set a default width and alignment for every cell in the grid:

d cellWidth="1/2">
ell>
<p>Lorem</p>
Cell>
ell>
<p>ipsum</p>
Cell>
id>

An example of setting widths and alignment per screen size for every cell in the grid:

d
allCellWidth="1"
allAlign="right"
allVerticalAlign="bottom"
diumCellWidth="1"
diumCellAlign="right"
diumCellVerticalAlign="bottom"

ell>
<p>Lorem</p>
Cell>
ell>
<p>ipsum</p>
Cell>
id>

An example of custom per-cell widths and alignments:

d>
ell
align="right"
verticalAlign="bottom"
width="1/4"

<p>Lorem</p>
Cell>
ell
align="left"
verticalAlign="top"
width="3/4"

<p>ipsum</p>
Cell>
ell
align="right"
verticalAlign="bottom"
width="3/4"

<p>dolor</p>
Cell>
ell
align="left"
verticalAlign="top"
width="1/4"

<p>sit</p>
Cell>
id>

The same as above, but with different per-cell widths on small screens:

d>
ell
align="right"
verticalAlign="bottom"
width="1/4"
smallWidth="1/2"

<p>Lorem</p>
Cell>
ell
align="left"
verticalAlign="top"
width="3/4"
smallWidth="1/2"

<p>ipsum</p>
Cell>
id>

Custom gutters can use any valid CSS value string. Percentage values create fluid gutters, while all other values create fixed gutters. Example:

d gutter="24px">
ell>
<p>Lorem</p>
Cell>
ell>
<p>ipsum</p>
Cell>
id>

d gutter="4%">
ell>
<p>Lorem</p>
Cell>
ell>
<p>ipsum</p>
Cell>
id>

While we recommend the default breakpoints, you can customize them:

t breakpoints = {
all: "@media only screen and (max-width: 320px)",
dium: "@media only screen and (min-width: 320px) and (max-width: 640px)",
rge: "@media only screen and (min-width: 641px) and (max-width: 1024px)",
arge: "@media only screen and (min-width: 1025px)"

d breakpoints={breakpoints}>
ell>
<p>Lorem</p>
Cell>
ell>
<p>ipsum</p>
Cell>
id>
Demo

There are more complex examples on the demo page. Check out the code in app.jsx.

Installation
Gotchas

<Grid /> only accepts <Cell />s as children, since inserting arbitrary children can break the layout. Two options for custom children are:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.