npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-flexbox-component

v0.2.9

Published

React Flexbox Component is a library to use flexbox css style to your components with real gutter and xRay option.

Downloads

20

Readme

React Flexbox Component

React Flexbox Component is a library to use flexbox css style to your components with real gutter and xRay option.

Table of Content

Installing

npm install react-flexbox-component

Getting started

import React, { Component } from 'react'
import { Row, Column, Item } from 'react-flexbox-component'

class MyComponent extends Component {
  render() {
    return (
      <div>
        <Row gutter={8}>
          <Item>Item 1</Item>
          <Item>Item 2</Item>
        </Row>
        <Column>
          <Item>Item 1</Item>
          <Item>Item 2</Item>
        </Column>
      </div>
    )
  }
}

export default MyComponent;

Usage

{/* Direction : Row */}
<Row>...</Row>

{/* Direction : Column */}
<Column>...</Column>

{/* Flex item */}
<Item>...</Item>

Props

Column width

xs >= 0
sm >= 600
md >= 960
lg >= 1280
xl >= 1920

Example

<Row>
  {/* Auto width for all props xs sm md lg xl */}
  <Item xs>Item 1</Item>

  {/* @media (min-width: 0) flex-grow: 2; */}
  <Item xs={2}>Item 2</Item>

  {/* @media (min-width: 960) {flex-grow: 2}; */}
  {/* @media (min-width: 1280) {flex-grow: 4}; */}
  <Item md={2} lg={4}>Item 3</Item>
</Row>

Flex Grow

Change flex-grow attribute. Prop : grow Value : number Default : null

<Row>
  <Item grow={1}>Item 1</Item>
  <Item grow={8}>Item 2</Item>
</Row>

Gutter

Add a margin between boxes in pixel. Allowed for Row and Column and applied on direct children.

{/* Margin of 8px between Item 1 and Item 2 */}
<Row gutter={8}>
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>
{/* Margin of 16px between Item 3, Row and Div 1 */}
<Column gutter={16}>
  <Item>Item 3</Item>
  <Row>
    <Item>Item 4</Item>
    <Item>Item 5</Item>
  </Row>
  <div>Div 1</div>
</Column>

Align items

Change align-items attribute. Value : start | flex-start | end | flex-end | center | baseline | stretch Default : flex-start

<Row align="start">
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>

Align content

Change align-content attribute. Prop : content Value : start | flex-start | end | flex-end | center | space-between | space-around | stretch Default : flex-start

<Row content="start">
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>

Flex wrap

Change flex-wrap attribute. You can use the prop alone. Prop : wrap Value : no-wrap | wrap | wrap-reverse Default : null

{/* flex-wrap: wrap-reverse */}
<Row wrap="wrap-reverse">
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>
{/* flex-wrap: wrap */}
<Row wrap>
  <Item>Item 3</Item>
  <Item>Item 4</Item>
</Row>

Justify content

Change justify-content attribute. Prop: justify Value : start | flex-start | end | flex-end | space-between | space-around | space-evenly Default : flex-start

<Row justify="start" xRay>
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>

xRay

Display 1px border and background color to help you to visualize your layout and their childs

<Row xRay>
  <Item>Item 1</Item>
  <Item>Item 2</Item>
</Row>