React Clean UI
Surface

Box

A simple themed container for grouping content.

The Box component is a themed container that provides a background, border, rounded corners, padding, and shadow. It is useful for grouping related UI elements such as forms, cards, panels, or settings sections.

Example

<Box spacing="md">
    <VStack>
        <Text text="Account Settings" variant="heading" />
        <Text text="Manage your account preferences." />
    </VStack>
</Box>

Sizing

Box supports the standard sizing props, allowing it to fill available space or use fixed dimensions.

<Box width="300px" height="200px">
    <Text text="Fixed size box" />
</Box>

Props

PropTypeDescription
widthCssSizeWidth of the box.
heightCssSizeHeight of the box.
SizeUDim2Overrides width and height with an explicit Roblox size.
spacingSpaceSizeControls the internal padding.
BackgroundColor3Color3Overrides the themed background colour.
BackgroundTransparencynumberOverrides the themed background transparency.
box-shadowCssShadowOverrides the default shadow.
ZIndexnumberSets the rendering order.

Notes

  • Uses the current theme for colours, border, corner radius, shadow, and padding.
  • Automatically sizes vertically to fit its children.
  • Accepts any child components.

On this page