1.0.0 • Published 5 years ago

react-xy-grid v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

react-xy-grid

React component that wraps Foundation's XY Grid.

code style: prettier Commitizen friendly npm version

Table of Contents

Installation

Begin by installing the package as a dependency.

npm i -S react-xy-grid

Start utilizing the components where needed.

import * as React from "react";
import { Cell, Grid, GridContainer } from "react-xy-grid";

const Home = () => {
  return (
    <GridContainer>
      <Grid gridX valign="middle">
        <Cell sm={12} lg={6}>
          <span>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</span>
        </Cell>
        <Cell sm={12} lg={6}>
          <a href="/explicabo">Explicabo!</a>
        </Cell>
      </Grid>
    </GridContainer>
  );
};

export default Home;

Cell

NameTypeRequiredDefault Value
autobooleanfalsefalse
childrenReactNodetrueundefined
classNamestringfalseundefined
componentstringfalse"div"
lg"auto", "shrink", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
lgOffset1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
md"auto", "shrink", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
mdOffset1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
shrinkbooleanfalsefalse
sm"auto", "shrink", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
smOffset1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
valign"bottom", "middle", "stretch", or "top"falseundefined

Grid

NameTypeRequiredDefault Value
align"center", "justify", "right", or "spaced"falseundefined
childrenReactNodetrueundefined
classNamestringfalseundefined
componentstringfalse"div"
gridXbooleanfalsefalse
gridYbooleanfalsefalse
heightnumber or stringfalseundefined
lgCollapse"margin" or "padding"falseundefined
lgUp1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
marginXbooleanfalsefalse
marginYbooleanfalsefalse
mdCollapse"margin" or "padding"falseundefined
mdUp1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
paddingXbooleanfalsefalse
paddingYbooleanfalsefalse
smCollapse"margin" or "padding"falseundefined
smUp1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12falseundefined
valign"bottom", "middle", "stretch", or "top"falseundefined

Grid Container

NameTypeRequiredDefault Value
childrenReactNodetrueundefined
classNamestringfalseundefined
componentstringfalse"div"
fluidbooleanfalsefalse
fullbooleanfalsefalse

Notes

If you import the components for use via the module namespace like so:

import { Cell, Grid, GridContainer } from "react-xy-grid";

Using this syntax, you will not have to manually import the CSS file as the module's index file import's a compiled CSS version of the Foundation styles.

This assumes that your build system is configured to handle importing .css files in your scripts.

However, there is a .scss in the module's directory that can be used to generate the Foundation styles at compile time. If this is the desired result, you will need to adjust the above import statement, to avoid importing the .css file.

import Cell from "react-xy-grid/Cell/Cell";
import Grid from "react-xy-grid/Grid/Grid";
import GridContainer from "react-xy-grid/GridContainer/GridContainer";

This may be valuable if your build system is not configured to handle importing .css files in your scripts.

Additionally, you will have to import the module's .scss file.

@import "~react-xy-grid/index.scss";

// or

@import "../../node_modules/react-xy-grid/index.scss";

The first import example assumes your sass compiler supports the ~ syntax to import from node_modules

1.0.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago