azz / styled-css-grid

šŸ± A tiny CSS grid layout for React
https://styled-css-grid.js.org/
MIT License
623 stars 42 forks source link
css grid react styled-components

styled-css-grid šŸ±

Travis Prettier npm semantic-release License JS.ORG

A tiny (~2kb) CSS grid layout for React, built with styled-components šŸ’….

examples

See the website.

installation

Install React and styled-components, then:

$ yarn add styled-css-grid

usage

import React from "react";
import { Grid, Cell } from "styled-css-grid";

const MyGrid = () => (
  <Grid columns={2} gap="2px">
    <Cell>foo</Cell>
    <Cell height={2}>bar</Cell>
    <Cell width={2}>baz</Cell>
  </Grid>
);

api

Grid

Wrap your cells in Grid. Pretty simple.

Props:

Cell

A cell. Not too much to say...

Props:

browser support

caniuse

You can use CSS grid in production today if you don't need to support IE and Edge, or you're building tooling or internal sites where you only need to support one browser.

You can use CSS grid soon if you have to support the latest version of modern browsers. Edge 16 will implement the latest CSS grid spec.

Can I use?