A versatile container used to provide layout and styling capabilities with configurable padding, margin, radius, and roundness.

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Box p="4" radius="md" className="border">
    <Text>Content inside a Box</Text>
  </Box>
</Flex>

Anatomy

<Box />

Examples

Box components are used to provide a styled wrapper for other components. Boxes use the theme settings by default, and can be specified as needed.

Radii

The radius prop controls the border-radius of the element using predefined scale values: none, xs, sm, md, lg, xl, full.

none

xs

sm

md

lg

xl

full

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Flex wrap="wrap" gap="4">
    {["none", "xs", "sm", "md", "lg", "xl", "full"].map((radius) => (
      <Box key={radius} radius={radius} p="2" className="border">
        <Text>{radius}</Text>
      </Box>
    ))}
  </Flex>
</Flex>

Roundness

The roundness prop sets a multiplier for the element's radius: 1 through 6.

1

2

3

4

5

6

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Flex wrap="wrap" gap="4">
    {["1", "2", "3", "4", "5", "6"].map((number) => (
      <Box key={number} radius="md" roundness={number} p="2" className="border">
        <Text>{number}</Text>
      </Box>
    ))}
  </Flex>
</Flex>

Padding

The p prop controls padding on all sides using predefined scale values 0 through 8.

0

1

2

3

4

5

6

8

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Flex wrap="wrap" gap="4">
    {["0", "1", "2", "3", "4", "5", "6", "8"].map((p) => (
      <Box key={p} p={p} className="border">
        <Text>{p}</Text>
      </Box>
    ))}
  </Flex>
</Flex>

Margin

The m prop controls margin on all sides using predefined scale values 0 through 8.

0

1

2

3

4

5

6

8

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Flex wrap="wrap" gap="4">
    {["0", "1", "2", "3", "4", "5", "6", "8"].map((m) => (
      <Box key={m} m={m} className="border" p="2">
        <Text>{m}</Text>
      </Box>
    ))}
  </Flex>
</Flex>