0.10.1 • Published 3 years ago

boxi v0.10.1

Weekly downloads
9
License
-
Repository
-
Last release
3 years ago

Boxi

Boxi is a library that allows you to specify styles such as margins and padding for Div elements.
The styles that can be specified are based on the Material-ui Box.

Github issues Github forks Github stars Github top language Github license npm version

Tags

react

Advantages

  • You can pass properties such as margins, padding, colors, and alignment to the Div element. It's easier to write than inline style.
  • Written in CSS in JS using Emotion, it should have a performance advantage over inline style. (Unmeasured)

Installation

  • yarn

    yarn add boxi
  • npm

    npm install boxi

Usage

import Box from 'boxi';

// You can define any props as below
const Component = () => <Box m="4px">Children</Box>;

API

borders

PropCSS property
borderborder
borderTopborder-top
borderLeftborder-left
borderRightborder-right
borderBottomborder-bottom
borderColorborder-color
borderRadiusborder-radius
<Box border="1px" borderColor="red"></Box>
<Box borderTop="1px"></Box>

display

PropCSS property
displaydisplay
overflowoverflow
textOverflowtext-overflow
visiblityvisiblity
whiteSpacewhite-space
<Box whiteSpace="nowrap"></Box>

flexbox

PropCSS property
flexBasisflex-basis
flexDirectionflex-direction
flexWrapflex-wrap
justifyContentjustify-content
justifyItemsjustify-items
justifySelfjustify-self
alignItemsalign-items
alignContentalign-content
orderorder
flexflex
flexGrowflex-grow
flexShrinkflex-shrink
alignSelfalign-self
<Box display="flex" justifyContent="space-between" alignItems="center">
  <Box>1</Box>
  <Box>2</Box>
  <Box>3</Box>
</Box>

palette

PropCSS property
colorcolor
backgroundbackground
backgroundColorbackground-color
<Box color="red" backgroundColor="gray">
  colored box
</Box>

positions

PropCSS property
positionposition
zIndexz-index
toptop
rightright
bottombottom
leftleft
<Box zIndex="1000"></Box>

shadows

PropCSS property
boxShadowboxShadow
<Box boxShadow="10px 10px 10px 10px rgba(0,0,0,0.4)"></Box>

sizing

PropCSS property
widthwidth
maxWidthmax-width
minWidthmin-width
heightheight
maxHeightmax-height
minHeightmin-height
boxSizingbox-sizing
<Box width="100%"></Box>
<Box height="100px"></Box>

spacing

PropCSS property
mmargin
mtmargin-top
mrmargin-right
mbmargin-bottom
mlmargin-left
mxmargin-left, margin-right
mymargin-top, margin-bottom
ppadding
ptpadding-top
prpadding-right
pbpadding-bottom
plpadding-left
pxpadding-left, padding-right
pypadding-top, padding-bottom
<Box mt="10px">text</Box>
<Box px="10px">text</Box>

Some people find the prop shorthand confusing, you can use the full version if you prefer:

<Box marginTop="10px">text</Box>
<Box paddingX="10px">text</Box>

typography

PropCSS property
fontFamilyfont-family
fontSizefont-size
fontStylefont-style
fontWeightfont-weight
latterSpacingletter-spacing
lineHeightline-height
textAligntext-align
<Box textAlign="center">text</Box>

Contributors

0.10.1

3 years ago

0.10.0

3 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago