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 cross-platform layout primitive for React and React Native._

  • 0.0.10
  • Source
  • npm
  • Socket score

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

React Boxen

A cross-platform layout primitive for React and React Native.

Boxen utilizes styled-components 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
  • Themeable - coming soon...

Basic Usage

import Box from "react-boxen"

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

API

PropertyTypeValue (default *)Description
alignStringauto * flex-start flex-end center stretch baselineOverride childAlign of parent <Box/>
backgroundColorStringColor...
borderColorStringColor...
borderRadiusStringLength...
borderStyleStringLength...
borderWidthStringLength...
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
colorStringColor...
cssStringTemplate literal containing valid CSSSee styled-components documentation
growNumber0 *Amount Box should grow to fill available space
heightStringLength...
opacityNumber1.0-0.0...
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.)

FAQs

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