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
Size: 1879
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
<div>
s!style
arrays and resolves them with Radium Style.Although this is prerelease software, we'll do our best to avoid breaking public API changes.
npm install --save radium-grid
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>
There are more complex examples on the demo page. Check out the code in app.jsx.
npm install -g builder
npm install
and then builder run hot
will load a webpack dev server at localhost:3000<Grid />
only accepts <Cell />
s as children, since inserting arbitrary children can break the layout. Two options for custom children are:
<Cell />
.<Grid>
.