1.0.7 • Published 3 years ago

@zirayhao/box v1.0.7

Weekly downloads
2
License
-
Repository
github
Last release
3 years ago

Box

Box is an intutive layout component for React projects. As a easily tunable flexbox, it removes the hassle of styling flexing properties and offers an immediate sense of the UI layout right in the JSX.

Installation

npm install @zirayhao/box

Quick Start

Import it into your React component.

import React from 'react'
import Box from '@zirayhao/box'

const Component = (props) => {
  return(
    <Box row justify="center" align="center" wrap flex={1}>
      <Box col>
        <h1>Hello</h1>
        <Box height={50} className="vertical-spacer">
        <p>Some text</p>
      </Box>
      <Box width={100} className="horizontal-spacer">
      <img src={image} />
    </Box>
  );
}

Docs

PropTypeDescriptionDefault
rowbooleanFlexes the box horizontally if true.true
colbooleanFlexes the box vertically if true.false
justifystringControls content justification. One of start (flex-start), end (flex-end), center, between (space-between), around (space-around).start
alignstringAligns items. One of start (flex-start), end (flex-end), center , stretch (stretch).stretch
selfstringControls its self alignment if embedded in a parent flex box. One of start (flex-start), end (flex-end), center , stretch (stretch).None
wrapbooleanDeclares wrapping behavior, true for flex-wrap.false
flexnumberControls the flex growth.None
widthnumber \| stringDirectly modifies the CSS width property. Example inputs are 50, 50px, 70%.None
heightnumber \| stringDirectly modifies the CSS height property. Example inputs are 50 , 50px , 70% .None
padnumber \| string \| arrayIf of type number or string, directly modifies the CSS padding property. If of type array, each element corresponds to the top, bottom, left, and right paddings.None
idstringInjects a DOM id.None
classNamestringInjects DOM classes.None

Author

Ziray Hao

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago