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

react-boxen

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-boxen

A layout primitive for React.

  • 0.0.30
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

React Boxen

A layout primitive for React.

Boxen utilizes glamor to provide cross-browser/cross-platform layout.

Why?

  • Flex Box Plus - Provides a helpful layer of abstraction on top of the robust (and sometimes confusing) display flex properties
  • Child spacing - Provides consistent spacing between child elements vertically, horizontally, and wrapping

Basic Usage

import Box from "react-boxen"

export default function MyComponent(props) {
  return (
    <Box
      style={{backgroundColor: "whitesmoke"}}
      padding="20px"
      childSpacing="10px">
      <Box grow="1">Box 1</Box>
      <Box grow="1">Box 2</Box>
      <Box grow="1">Box 3</Box>      
    </Box>
  )
}

API

PropertyTypeValue (default *)Description
alignStringauto * flex-start flex-end center stretch baselineOverride childAlign of parent <Box/>
basisStringLengthIndividual flex-basis. Think of it as ideal length.
childAlignStringflex-start * flex-end center stretch baselineAlign children along the cross axis
childBasisStringLengthWhen childWrap='wrap' and non-percentage length, children will grow/shrink to roughly maintain this size. Think of it as ideal length.
childDirectionStringcolumn * column-reverse row row-reverseVertical or horizontal orientation of children
childJustifyStringflex-start * flex-end center space-between space-aroundAlign children along the main axis
childWrapStringnowrap * wrap wrap-reverseDefine whether or not children can wrap
childWrapLastGrowStringnowrap * wrap wrap-reverseDefine whether or not children can wrap
childWrapCountNumber20 *Typical items show before wrapping. Useful for maintaining ChildBasis width when fewer than typical wrap count.
childSpacingStringLengthSpacing between children on any axis
cssStringTemplate literal containing valid CSSSee styled-components documentation
growNumber0 *Amount Box should grow to fill available space
heightStringLength...
paddingStringCSS length...
shrinkNumber1 *Amount Box should shrink inside available space
widthStringLength...
...restAnyAnyRest of props (aside from children) are spread onto Box itself (e.g. onClick, onPress, etc.)

Roadmap

Technically, there is nothing preventing usage with React Native. The web is a more immediate proving ground. As the API solidifies, testing and support will be hammered out for RN. PRs are always welcome!

FAQs

Package last updated on 17 Apr 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