Skip to Content
Nextra 4.0 is released 🎉

Box

The Box component is a foundational PixelartUI layout element designed to structure and group content within a pixel-art styled interface. It provides flexible styling options such as custom colors, dimensions, and layout behavior while maintaining the distinctive retro aesthetic that defines PixelartUI.


🚀 Usage

Basic Example


Box Content
import { Box } from "pixelartui-react"; <Box> <div class="cp-box-content">Box Content</div> </Box>

Box Custom Colour


Custom Colour
<Box backgroundColor="#05EB57"> <div class="cp-box-content">Custom Colou</div> </Box>

Box Style


Dark Box
Light Box
<Box> <div class="cp-box-content">Dark Box</div> </Box> <div class="cp-dark-bg"> <Box boxStyle="light"> <div class="cp-box-content">Light Box</div> </Box> </div>

Box Custom size


Custom Size
<div className="cp-box-container"> <Box width="400px" height="200px"> <div class="cp-box-content">Dark Box</div> </Box> </div>

Box Custom size


Full width
<Box fullwidth> <div class="cp-box-content">Full width</div> </Box>

🔧 Props

PropTypeDefaultDescription
childrenReactNodeContent to be rendered inside the Box.
backgroundColorstringundefinedSets a custom background color for the Box.
classNamestringundefinedAdds additional CSS classes for custom styling.
boxStyleBoxStyleundefinedApplies a predefined PixelartUI box style or theme.
widthstringundefinedSets a custom width (e.g., "200px", "100%").
heightstringundefinedSets a custom height.
fullwidthbooleanfalseMakes the Box expand to fill the width of its container.
Last updated on