apps/www/content/docs/components/box.mdx
The Box component provides an easy way to write styles with ease. It provides
access to design tokens and an unmatched DX when writing responsive styles.
import { Box } from "@chakra-ui/react"
<Box />
Use shorthand like bg instead of backgroundColor, m instead of margin,
etc.
Use pseudo props like _hover to apply styles on hover, _focus to apply
styles on focus, etc.
Use the borderWidth and borderColor prop to apply border styles.
<ExampleTabs name="box-with-border" />Good to know: Chakra applies
borderStyle: solidglobally so you don't have to.
Use the as prop to render a different component.
<ExampleTabs name="box-with-as-prop" />Inspect the DOM to see the rendered component.
Use the boxShadow or shadow prop to apply shadow styles.
Here's an example of a property card built with layout primitives in Chakra.
<ExampleTabs name="box-property-card" />The Box component supports all CSS properties as props, making it easy to
style elements.