If you're looking for a flexible component to help with low-level layout needs, the Box component might be just what you need. With its customizable styles and props, it can be used to create a wide range of UI elements, from simple containers to complex layout structures.
This is an illustration of Box component.
<Box className="bg-primary-500 p-5">
<Text className="text-typography-0">This is the Box</Text>


Step 1: Copy and paste the following code into your project.

import React from "react"
import { View } from "react-native"
import { tva } from "@gluestack-ui/nativewind-utils"
const boxStyle = tva({})
const Box = React.forwardRef(({ className, ...props }: any, ref) => {
return <View ref={ref} className={boxStyle({ class: className })} />
Box.displayName = "Box"
export { Box }

Step 2: Update the import paths to match your project setup.

To use this component in your project, include the following import statement in your file.
import { Box } from "@/components/ui/Box"
export default () => <Box />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.


It inherits all the properties of React Native's View component.
Edit this page on GitHub