To implement Box component into your project you’ll need to add the import:
import Box from "@kiwicom/orbit-components/lib/Box" ;
After adding import into your project you can use it simply like:
Table below contains all types of the props available in the Box component.
Namedata-transfer-vertical Type Default Description as string
"div"
Render as element. className string
The optional className of Box. children React.Node
The children of the Box. dataTest string
Optional prop for testing purposes. id string
Set id
for Box
display enum
The display
of the Box padding spacingObject
| spacingToken
The padding
of the Box margin spacingObject
| spacingToken
The margin
of the Box wrap enum
The flex-wrap
of the Box shrink number
The flex-shrink
of the Box grow number
The flex-grow
of the Box align enum
The align-items
of the Box justify enum
The justify-content
of the Box direction enum
The flex-direction
of the Box width enum
The width
of the Box minWidth string
The min-width
of the Box maxWidth string
The max-width
of the Box height enum
The height
of the Box maxHeight string
The max-height
of the Box position position
The position
of the Box left string
The left
of the Box zIndex number
The z-index
of the Box top string
The top
of the Box right string
The right
of the Box bottom string
The bottom
of the Box textAlign textAlign
The text-align
of the Box elevation elevation
The box-shadow
of the Box color string
The color
of the Box background string
The background
of the Box borderRadius borderRadius
The border-radius
of the Box overflow overflow
The overflow
of the Box largeDesktop MediaQueries
Object for setting up properties for the largeDesktop viewport. desktop MediaQueries
Object for setting up properties for the desktop viewport. tablet MediaQueries
Object for setting up properties for the tablet viewport. largeMobile MediaQueries
Object for setting up properties for the largeMobile viewport. mediumMobile MediaQueries
Object for setting up properties for the mediumMobile viewport.
When you need to specify some different behavior of the Box component on different viewport, you can use properties for it.
There are mediumMobile
, largeMobile
, tablet
, desktop
and largeDesktop
available and it behaves the same as mediaQueries functions.
All this properties - objects have the some own properties and none is required.
Namedata-transfer-vertical Type Default Description padding spacingObject
| spacingToken
The padding
of the Box margin spacingObject
| spacingToken
The margin
of the Box wrap enum
The flex-wrap
of the Box shrink number
The flex-shrink
of the Box grow number
The flex-grow
of the Box align enum
The align-items
of the Box justify enum
The justify-content
of the Box direction enum
The flex-direction
of the Box width enum
The width
of the Box maxWidth string
The max-width
of the Box height enum
The height
of the Box maxHeight string
The max-height
of the Box position position
The position
of the Box left string
The left
of the Box top string
The top
of the Box right string
The right
of the Box bottom string
The bottom
of the Box textAlign textAlign
The text-align
of the Box elevation elevation
The box-shadow
of the Box color string
The color
of the Box background string
The background
of the Box borderRadius borderRadius
The border-radius
of the Box overflow overflow
The overflow
of the Box
display justify direction align wrap width height "none"
"start"
"row"
"start"
"nowrap"
"full"
"full"
"flex"
"end"
"column"
"end"
"wrap"
"auto"
"auto"
"inline-flex"
"center"
"row-reverse"
"center"
string
string
"block"
"between"
"column-reverse"
"stretch"
"inline"
"around"
"inline-block"
"list-item"
position "relative"
"absolute"
"fixed"
textAlign "start"
"end"
"left"
"center"
"right"
borderRadius "small"
– deprecated (use "50"
) "normal"
– deprecated (use "100"
) "large"
– deprecated (use "150"
) "circle"
– deprecated (use "full"
) "full"
"50"
"100"
"150"
"300"
"400"
overflow "auto"
"hidden"
"scroll"
"visible"
elevation "action"
– deprecated (use "level1"
) "fixed"
"fixedReverse"
"overlay"
– deprecated (use "level4"
) "raised"
– deprecated (use "level3"
) "raisedReverse"
– deprecated (use "level3Reverse"
) "level1"
"level2"
"level3"
"level3Reverse"
"level4"
If you want to define spacingObject
, you can define specific directions like this:
<Box margin={{ top: "XXSmall", bottom: "XXSmall" }} />
spacingToken "none"
"XXXSmall"
- deprecated (use "50"
) "XXSmall"
- deprecated (use "100"
) "XSmall"
- deprecated (use "200"
) "small"
- deprecated (use "300"
) "medium"
- deprecated (use "400"
) "large"
- deprecated (use "600"
) "XLarge"
- deprecated (use "800"
) "XXLarge"
- deprecated (use "1000"
) "50"
"100"
"150"
"200"
"300"
"400"
"500"
"600"
"800"
"1000"
"1200"
"1600"