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 🙏

© 2026 – Pkg Stats / Ryan Hefner

prefixed-reflexbox

v1.1.7

Published

React flexbox layout and grid system

Readme

reflexbox

React flexbox layout and grid system, built with stateless components and inline styles

Build Status Code Climate npm version

Getting Started

npm install reflexbox
// Example
import React from 'react'
import { Flex, Box } from 'reflexbox'

class Component extends React.Component {
  render() {
    return (
      <Box p={2}>
        <Flex align='center'>
          <Box px={2}>Box A</Box>
          <Box px={2} auto>Box B</Box>
        </Flex>
      </Box>
    )
  }
}

Reflexbox is composed of two React v0.14 stateless function components that can handle virtually any layout composition.

<Flex />

A component that creates a flexbox context to control layout of children.

Props

  • wrap (boolean) Sets flex-wrap: wrap.
  • column (boolean) Sets flex-direction: column.
  • align (string) Sets align-item. Accepted values: stretch, center, baseline, flex-start, flex-end
  • justify (string) Sets justify-content. Accepted values: center, space-around, space-between, flex-start, flex-end
  • gutter (number) Sets negative left and right margins to compensate for <Box /> padding.
  • sm (boolean) Sets display: flex only above the small breakpoint *
  • md (boolean) Sets display: flex only above the medium breakpoint *
  • lg (boolean) Sets display: flex only above the large breakpoint *
  • auto (boolean) Sets flex: 1 1 auto

<Box />

A component that sets padding and width that works independently or as a child component of <Flex />.

Props

  • auto (boolean) Sets flex: 1 1 auto
  • flex (boolean) Sets display: flex
  • align (string) Sets align-self property
  • order (number) Sets order property
  • col (number) Sets width and flex-basis based on a twelve column grid.
  • sm (number) Sets width and flex-basis above the small breakpoint based on a twelve column grid. *
  • md (number) Sets width and flex-basis above the medium breakpoint based on a twelve column grid. *
  • lg (number) Sets width and flex-basis above the large breakpoint based on a twelve column grid. *

Shared Props

Both <Box /> and <Flex /> accept the following props:

  • is (element or node) Passes in a custom element or component
  • m (number) Sets margin based on a scale from 0 – 4. **
  • mx (number) Sets x-axis margin based on a scale from 0 – 4. **
  • my (number) Sets y-axis margin based on a scale from 0 – 4. **
  • mt (number) Sets margin-top based on a scale from 0 – 4. **
  • mb (number) Sets margin-bottom based on a scale from 0 – 4. **
  • ml (number) Sets margin-left based on a scale from 0 – 4. **
  • mr (number) Sets margin-right based on a scale from 0 – 4. **
  • p (number) Sets padding based on a scale from 0 – 4. **
  • px (number) Sets x-axis padding based on a scale from 0 – 4. **
  • py (number) Sets y-axis padding based on a scale from 0 – 4. **
  • pt (number) Sets padding-top based on a scale from 0 – 4. **
  • pb (number) Sets padding-bottom based on a scale from 0 – 4. **
  • pl (number) Sets padding-left based on a scale from 0 – 4. **
  • pr (number) Sets padding-right based on a scale from 0 – 4. **
  • style (object) Assigns styles to the component ***
  • className (string) Adds a class to the component ***

* Breakpoint props

The sm, md, and lg props are based on the keys from the config.breakpoints object. When setting custom values for breakpoints, these props will match the keys of the custom breakpoints object.

** Spacing scale props

The values for padding and gutter props are based on the length of the config.scale array. When setting custom values for the spacing scale, the values should be from 0 through the length of the array.

*** style and className props

The style and className props are added as a convenience and are only recommended for adding color styles. For other layout styles, prefer using component composition over using these props.

Configuration

Values for the spacing scale and breakpoints can be configured with React Context.

To configure reflexbox, add childContextTypes and getChildContext to a container component.

class App extends React.Component {
  static childContextTypes = {
    reflexbox: React.PropTypes.object
  }

  getChildContext () {
    return {
      reflexbox: {
        scale: [0, 10, 20, 40, 80],
        breakpoints: {
          mobile: '(min-width: 30em)',
          tablet: '(min-width: 48em)',
          desktop: '(min-width: 60em)'
        }
      }
    }
  }

  render () {
    return (
      <Flex gutter={2}>
        <Box mobile={6} tablet={3}>Box</Box>
        <Box mobile={6} tablet={3}>Box</Box>
        <Box mobile={6} tablet={3}>Box</Box>
        <Box mobile={6} tablet={3}>Box</Box>
      </Flex>
    )
  }
}

Advanced Usage

is prop

Change the root component of Flex or Box with the is prop.

<Flex
  is={MyHeader}
  gutter={2}
  align='center'>
  <Box
    is='h1'
    px={2}
    auto>
    Hello
  </Box>
  <Box px={2}>
    Box
  </Box>
</Flex>

Tests

Runs tests with React shallow rendering and browser tests with Karma for four different breakpoints.

npm test

MIT License