If you need a flexible component to assist with low-level design needs, Box is an ideal choice. This low-level component is just what you need for a wide range of tasks. With its customizable styles and properties, Box can be used to create everything from simple containers to more complex design structures.


This example demonstrates how to use Box with the default configuration.

  • Create layouts with ease.
  • Use it as a container for other components.
  • Provide a shorthand way to pass styles via props, example: (bgColor instead of backgroundColor).
<Box bgColor="blue" border="xl" p="xs">
  <Text>This is the Box</Text>


To use this component in your project, include the following import statement in your file.

import { Box } from "@design-blocks/primitives";


Rest assured that Box inherits all the properties of the React Native View component.

styles props

Style props are a way to alter the style of a component by simply passing props to it. It helps to save time by providing helpful shorthand ways to style components.

<Box w="lg" h="lg" bgColor="blue" border="xl" m="lg" p="xs" borderRadius="md">
  <Text>This is the Box</Text>

To find out which properties are theme-aware, see the Style Props.


The system prop that allows defining system overrides as well as additional CSS styles.

<Box bgColor="blue" border="xl" p="xs" sx={{ bgColor: "red" }}>
  <Text>This is the Box</Text>

In this case, sx will overwrite the bgColor passed as a prop, resulting in a Box with a red backgroundColor.

See the sx page for more details.


It's important to note that primitive components come without predefined styles. For more information, please refer to this link.