Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-react

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-react

A lightweight React component library to build flex-based grids.

  • 1.2.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Flex React v1.2.10

Flex React is a grid-based set of components for React. It offers the following features:

  • Created to be a lightweight grid solution
  • Component-based grid system
  • Styles written using CSS flexbox
  • All styling used is prefixed to work across browsers
  • Only peer-dependency is React
  • Designed to help build mobile-responsive applications
  • Easy to use!

As of v1.2.6, there is no padding prop in any component.

In a later version I may add a method to create a wrapper around these components to specify padding, but I could not resolve a specific style bug where an overflow of Col inside a Row would cause issues.

As a result, Grid has no actual purpose as of v1.2.6.

In the meantime, this package will have no supported way of creating 'gutters'/padding between components. Thanks

Install

npm install --save flex-react

If you don't see any styling appear, import this file somewhere high-level in your app:

import 'flex-react/dist/style.css';

Example

import React, { Component } from 'react';
import { Grid, Row, Col } from 'flex-react';


class Example extends Component {
    render() {
        return (
            <Grid className="example">
                <Row>
                    <Col sm={6}>
                        <p>Apart from on mobile, this will take up 50% of the row!</p>
                    </Col>

                    <Col sm={6}>
                        <p>And this will take up the other 50%!</p>
                    </Col>
                </Row>

                <Row center>
                    <Col xs={4}>
                        <p>This will be centered!</p>
                    </Col>
                </Row>

                <Row>
                    <Col xs={4} xsOffset={4}>
                        <p>This is another way to make something centered!</p>
                    </Col>
                </Row>

                <Row spaceBetween>
                    <Col sm={3}>
                        <p>This will be aligned on the left,</p>
                    </Col>

                    <Col sm={3}>
                        <p>and this will be aligned on the right!</p>
                    </Col>
                </Row>
            </Grid>
        );
    }
}

example code

Notes

AbbreviationMeaningScreen SizePixels
xsExtra SmallMobile0 to 767px
smSmallTablet768px to 991px
mdMediumLaptop Monitor992px to 1199px
lgLargeDesktop Monitor1200px and up

Components

Col

PropertyTypeDefaultDescription
childrenAnyThe content to wrap inside the column.
classNameStringEmpty stringA class name to give custom styling to the column.
xsNumber12The number of units to set as the column width. (0-12)
smNumber[xs]The number of units to set as the column width. (0-12)
mdNumber[sm]The number of units to set as the column width. (0-12)
lgNumber[md]The number of units to set as the column width. (0-12)
xsOffsetNumber0The number of units to pad the left to the left of the column. (0-12)
smOffsetNumber[xsOffset]The number of units to pad the left to the left of the column. (0-12)
mdOffsetNumber[smOffset]The number of units to pad the left to the left of the column. (0-12)
lgOffsetNumber[mdOffset]The number of units to pad the left to the left of the column. (0-12)
...restPropsUse this to add any additional props to the
component.

Row

PropertyTypeDefaultDescription
childrenAnyThe content to wrap inside the row.
classNameStringEmpty stringA class name to give custom styling to the row.
xsNumber12The number of units to set as the row width. (0-12)
smNumber[xs]The number of units to set as the row width. (0-12)
mdNumber[sm]The number of units to set as the row width. (0-12)
lgNumber[md]The number of units to set as the row width. (0-12)
vAlignBooleanfalseWhether the children should be centered vertically within the row.
centerBooleanfalseWhether the children should be centered horizontally within the row.
leftBooleanfalseWhether the children should be left aligned within the row.
rightBooleanfalseWhether the children should be right aligned within the row.
spaceAroundBooleanfalseWhether each children should have equal spacing to the left and right within the row.
spaceBetweenBooleanfalseWhether the children should have maximal spacing between each other within the row.
...restPropsUse this to add any additional props to the
component.

Grid

PropertyTypeDefaultDescription
childrenAnyThe content to wrap inside the cgrid.
classNameStringEmpty stringA class name to give custom styling to the grid.
...restPropsUse this to add any additional props to the
component.

Development

To begin development, run the following:

npm start

This will host a webpack dev server at localhost:3000 where you can play around with the components.

The main file/'test harness' is located under /dev and webpack will serve them from /dev-build.

To modify the components themselves, simply edit them under the /src directory.

To build the files, simply run:

npm run build

File an issue for any bugs found, or if you want any features added. I'm happy to always keep improving this package, let me know if you run into any errors.

Thanks!

Keywords

FAQs

Package last updated on 06 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc