Skip to Content
DocsResourcesShowcase

Layout

JSX style props to control the width, height, and spacing of elements

Use the aspectRatio prop to set the desired aspect ratio of an element.

// raw value
<Box aspectRatio="1.2" />

// token
<Box aspectRatio="square" />
PropCSS PropertyToken Category
aspectRatioaspect-ratioaspectRatios

Use the breakAfter prop to set how page, column, or region breaks should behave after an element.

<Box columns="2">
  <Box>Item 1</Box>
  <Box breakAfter="page">Item 2</Box>
</Box>
PropCSS PropertyToken Category
breakAfterbreak-after-

Use the breakBefore prop to set how page, column, or region breaks should behave before an element.

<Box columns="2">
  <Box>Item 1</Box>
  <Box breakBefore="page">Item 2</Box>
</Box>
PropCSS PropertyToken Category
breakBeforebreak-before-

Use the breakInside prop to set how page, column, or region breaks should behave inside an element.

<Box columns="2">
  <Box>Item 1</Box>
  <Box breakInside="avoid">Item 2</Box>
</Box>
PropCSS PropertyToken Category
breakInsidebreak-inside-

Use the boxDecorationBreak prop to set how box decorations should behave when the box breaks across multiple lines, columns, or pages.

<Box bgImage="linear-gradient(red, blue)" boxDecorationBreak="clone">
  Chakra is <br /> great!
</Box>
PropCSS PropertyToken Category
boxDecorationBreakbox-decoration-break-

Use the boxSizing prop to set the box sizing of an element.

<Box boxSizing="border-box" padding="4" width="8" height="8" />
PropCSS PropertyToken Category
boxSizingbox-sizing-

Use the columns prop to set the number of columns for an element.

<Box columns={2} />
PropCSS PropertyToken Category
columnscolumns-

Use the float prop to set the float of an element.

<Box>
  <Text>As much mud in the streets...</Text>
  <Box float="left">Float me</Box>
</Box>
PropCSS PropertyToken Category
floatfloat-

Use the clear prop to set whether an element must be moved below (cleared) floating elements that precede it.

<Box>
  <Box float="left">Left</Box>
  <Box float="right">Right</Box>
  <Box clear="none">
    As much mud in the streets as if the waters had but newly retired from the
    face of the earth, and it would not be wonderful to meet a Megalosaurus,
    forty feet long or so, waddling like an elephantine lizard up Holborn Hill.
  </Box>
</Box>
PropCSS PropertyToken Category
clearclear-

Use the isolation prop to set whether an element should explicitly create a new stacking context.

<Box isolation="isolate">
  <Box bg="red.500" width="10" height="10" />
</Box>
PropCSS PropertyToken Category
isolationisolation-

Use the objectFit prop to set how an image or video should be resized to fit its container.

<Image src="..." objectFit="cover" width="10" height="10" />
PropCSS PropertyToken Category
objectFitobject-fit-

Use the objectPosition prop to set how an element should be positioned within its container.

<Image src="..." objectPosition="center" width="10" height="10" />
PropCSS PropertyToken Category
objectPositionobject-position-

Use the overflow prop to control how content that exceeds an element's dimensions is handled. This property determines whether to clip the content, add scrollbars, or display the overflow content.

<Box overflow="hidden" maxHeight="120px" />
<Box overflow="auto" maxHeight="120px" />
PropCSS PropertyToken Category
overflowoverflow-

Use the overscrollBehavior prop to control what the browser does when reaching the boundary of a scrolling area.

<Box maxHeight="120px" overscrollBehavior="contain" />
PropCSS PropertyToken Category
overscrollBehavioroverscroll-behavior-

Use the position utilities to set the position of an element.

<Box position="absolute" />
<Box pos="absolute" /> // shorthand
PropCSS PropertyToken Category
positionposition-

Use the top, right, bottom and left utilities to set the position of an element.

<Box position="absolute" top="0" left="0" />

// using spacing tokens
<Box position="absolute" top="4" />

// using hardcoded values
<Box position="absolute" top="100px" />

Use the logical equivalents of inset{Start|End} utilities to set the position of an element based on the writing mode.

<Box position="absolute" insetStart="0" />
PropCSS PropertyToken Category
toptopspacing
rightrightspacing
bottombottomspacing
leftleftspacing
start, insetStart, insetInlineStartinset-inline-startspacing
end , insetEnd, insetInlineEndinset-inline-endspacing
insetX, insetInlineinset-inlinespacing
insetY, insetBlockinset-inlinespacing

Use the visibility prop to control the visibility of an element.

<Box visibility="hidden" />
PropCSS PropertyToken Category
visibilityvisibility-

Use the zIndex prop to set the z-index of an element.

// using hardcoded values
<Box zIndex="1" />

// using token
<Box zIndex="overlay" />
PropCSS PropertyToken Category
zIndexz-indexzIndices

Previous

Interactivity

Next

List