Skip to main content

Components

Box

Use the Box component as a layout primitive to add margin, padding, and colors to content.

banner-Box
Square Icon

Selected Theme

Select brand or tribe name to preview style

Default

Usage

Use the Box component as a layout primitive to add margin, padding, and colors to content.

import { Box } from 'legion-ui';

Variant

Legion have only one variant of box basic box


Basic

Box
<Box p={4} color="white" bg="primary500">
Box
</Box>

Props

propertypropTypedescription
as?stringHTML tag to be rendered as. Default value: div
bg?stringBackground color of rendered box
color?stringText color
m?string | numberMargin on all sides
mt?string | numberMargin on top
mr?string | numberMargin on right
mb?string | numberMargin on bottom
ml?string | numberMargin on left
mx?string | numberMargin on left and right
my?string | numberMargin on top and bottom
opacity?floatOpacity
p?string | numberPadding on all sides
pt?string | numberPadding on top
pr?string | numberPadding on right
pb?string | numberPadding on bottom
pl?string | numberPadding on left
px?string | numberPadding on left and right
py?string | numberPadding on top and bottom
style?objectThe style prop lets you style elements inline