Box
The lowest-level layout primitive.
A styled element with token-bound spacing, surface, radius and elevation. Reach for Box when you need a container that respects the design system without inventing a new component for it.
Import
import { Box } from "@abbainitiative/ui";Also available from the subpath entry @abbainitiative/ui/box.
This component has no state and no event handlers, so it renders inside a Server Component without a client boundary of your own.
Examples
Surfaces and spacing
Every visual property maps to a token, never a raw value.
Content on a subtle surface
<Box padding={5} background="subtle" radius="lg" bordered>
Content on a subtle surface
</Box>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| as | "div" | "span" | "section" | "article" | … | "div" | Element to render. A closed union rather than open polymorphism, which keeps prop errors readable. |
| padding | SpaceToken | Padding on both axes, from the 4px spacing scale. | |
| paddingInline | SpaceToken | Horizontal padding. Overrides padding on that axis only. | |
| paddingBlock | SpaceToken | Vertical padding. Overrides padding on that axis only. | |
| background | "none" | "default" | "subtle" | "raised" | "muted" | Background surface role. | |
| radius | "none" | "sm" | "md" | "lg" | "xl" | "full" | Corner radius token. | |
| shadow | "none" | "xs" | "sm" | "md" | "lg" | "xl" | Elevation token. | |
| bordered | boolean | false | Draws a one-pixel border using the current border token. |
Accessibility
- Box renders a plain element and adds no ARIA of its own.
- Choose a meaningful element with `as` — `section`, `article`, `nav` — rather than leaving everything a div.