Giter Club home page Giter Club logo

styled-css-grid's Introduction

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:

  • columns: The grid-template-columns CSS property. When a number is passed it is a shorthand to specify the number of columns. Default is 12.
  • gap: The grid-gap CSS property. Default is "8px".
  • columnGap: The column-gap CSS property. Not provided by default.
  • rowGap: The row-gap CSS property. Not provided by default.
  • minRowHeight: Minimum height of each row. Default is "20px".
  • height: The height CSS property. Default is "auto".
  • flow: The grid-auto-flow CSS property. Default is "row".
  • rows: The grid-template-rows CSS property. When a number is passed it is a shorthand to specify the number of rows. Not provided by default.
  • areas: The grid-template-areas CSS property. Pass an array of strings, e.g. ["a a", "b c"]. Not provided by default.
  • justifyContent: The justify-content CSS property. Not provided by default.
  • alignContent: The align-content CSS property. Not provided by default.

Cell

A cell. Not too much to say...

Props:

  • width: Cell width in units, default is 1.
  • height: Cell height in units, default is 1.
  • left: The grid-column-start CSS property. Not provided by default.
  • top: The grid-row-start CSS property. Not provided by default.
  • middle: Vertically align the contents of the cell. Default is false.
  • center: Horizontally align the text contents of the cell. Default is false.
  • area: The grid-area CSS property. Not provided by default.

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?

styled-css-grid's People

Contributors

azz avatar damassi avatar doemski avatar drshpongle avatar fnky avatar james-e-adams avatar jmlweb avatar jordanjustice avatar jvgreenaway avatar kilya11 avatar ladi-j avatar nickduncan7 avatar sugarshin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.