|
| 1 | +# WARNING: Don't use this unless you know your environment supports CSS Grid Layout! |
| 2 | + |
| 3 | +## react-css-grid-layout |
| 4 | + |
| 5 | +React components for wrapping your other react components in [CSS Grid Layout](http://www.w3.org/TR/css-grid-1/) inline. |
| 6 | + |
| 7 | +### Installation |
| 8 | + |
| 9 | +`npm install react-css-grid-layout` |
| 10 | + |
| 11 | +### Quick Start |
| 12 | + |
| 13 | +Maybe do something like this: |
| 14 | + |
| 15 | +```javascript |
| 16 | +import React from 'react' |
| 17 | +import { GridContainer, GridItem } from '../src' |
| 18 | + |
| 19 | +export default function Layout () { |
| 20 | + return ( |
| 21 | + <GridContainer rowTemplate='100px 1fr 1fr' |
| 22 | + columnTemplate=`300px 25px 300px` |
| 23 | + style={{ height: '100%' }}> |
| 24 | + <GridItem rows='2 / 3' columns='3 / 4'> |
| 25 | + <p>Content</p> |
| 26 | + </GridItem> |
| 27 | + <GridItem rows='1 / 4' columns='1 / 2' style={{ overflowY: 'scroll' }}> |
| 28 | + <h1>Sidebar</h1> |
| 29 | + </GridItem> |
| 30 | + </GridContainer> |
| 31 | + ) |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +### API |
| 36 | + |
| 37 | +#### `<GridContainer />` |
| 38 | + |
| 39 | +#### props (all optional) |
| 40 | + |
| 41 | +Most of the properties are just one-to-one mappings onto the CSS properties. See [Resources](#resources) for more information on using the spec. |
| 42 | + |
| 43 | +|Component Property | CSS property| |
| 44 | +|-------------------|-------------| |
| 45 | +|`rowTemplate`: *string* | grid-template-rows| |
| 46 | +|`columnTemplate`: *string* | grid-template-columns| |
| 47 | +|`areasTemplate`: *string* | grid-area-templates| |
| 48 | + |
| 49 | + |
| 50 | +`style`: *object* |
| 51 | + |
| 52 | +Will be added to the inline styles of the `<div>` that surrounds your children. Any property you pass will override those set by `react-css-grid-layout`. |
| 53 | + |
| 54 | +#### `<GridItem />` |
| 55 | + |
| 56 | +#### props (all optional) |
| 57 | + |
| 58 | +Most of the properties are just one-to-one mappings onto the CSS properties. |
| 59 | + |
| 60 | +|Component Property | CSS property| |
| 61 | +|-------------------|-------------| |
| 62 | +|`area`: *string* | grid-area | |
| 63 | +|`rowStart`: *number* | grid-row-start | |
| 64 | +|`rowEnd`: *number* | grid-row-end | |
| 65 | +|`rows`: *string* | grid-row | |
| 66 | +|`columnStart`: *number* | grid-column-start | |
| 67 | +|`columnEnd`: *number* | grid-column-end | |
| 68 | +|`columns`: *string* | grid-column | |
| 69 | + |
| 70 | +`style`: *object* |
| 71 | + |
| 72 | +Will be added to the inline styles of the `<div>` that surrounds your children. Any property you pass will override those set by `react-css-grid-layout`. |
| 73 | + |
| 74 | +### <a name="resources">Resources</a> for information about CSS Grid Layout |
| 75 | + |
| 76 | +* [The Specification](http://www.w3.org/TR/css-grid-1/) |
| 77 | +* [The future of layout with CSS: Grid Layouts](https://hacks.mozilla.org/2015/09/the-future-of-layout-with-css-grid-layouts/) |
| 78 | +* [Grid by Example: simple usage examples for the CSS3 Grid Layout Module](http://gridbyexample.com/) |
0 commit comments