1.0.0 • Published 9 years ago

react-css-grid-layout v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

WARNING: Don't use this unless you know your environment supports CSS Grid Layout!

react-css-grid-layout

React components for wrapping your other react components in CSS Grid Layout inline.

Installation

npm install react-css-grid-layout

Quick Start

Maybe do something like this:

import React from 'react'
import { GridContainer, GridItem } from '../src'

export default function Layout () {
  return (
    <GridContainer rowTemplate='100px 1fr 1fr'
                   columnTemplate=`300px 25px 300px`
                   style={{ height: '100%' }}>
      <GridItem rows='2 / 3' columns='3 / 4'>
        <p>Content</p>
      </GridItem>
      <GridItem rows='1 / 4' columns='1 / 2' style={{ overflowY: 'scroll' }}>
        <h1>Sidebar</h1>
      </GridItem>
    </GridContainer>
  )
}

API

<GridContainer />

props (all optional)

Most of the properties are just one-to-one mappings onto the CSS properties. See Resources for more information on using the spec.

Component PropertyCSS property
rowTemplate: stringgrid-template-rows
columnTemplate: stringgrid-template-columns
areasTemplate: stringgrid-area-templates

style: object

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.

<GridItem />

props (all optional)

Most of the properties are just one-to-one mappings onto the CSS properties.

Component PropertyCSS property
area: stringgrid-area
rowStart: numbergrid-row-start
rowEnd: numbergrid-row-end
rows: stringgrid-row
columnStart: numbergrid-column-start
columnEnd: numbergrid-column-end
columns: stringgrid-column

style: object

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.

Resources for information about CSS Grid Layout