Box
stableA low-level layout primitive.
Basic usage
Box
Examples
As a layout wrapper
Use Box when you want the smallest possible styled layout primitive and full control through className.
Project status
Build checks are running for the release branch.
asChild composition
Pass asChild when Box should style another element, such as a semantic section.
Supported props
Use display, spacing shortcuts, asChild and className for system-style composition.
Grid display with padding 4
Features
- Renders a div by default.
- Supports asChild composition.
Installation
bash
pnpm dlx structyl add boxAPI Reference
Box
Low-level layout wrapper.
| Prop | Type | Default |
|---|---|---|
| display | 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'grid' | 'contents'Display utility applied to the root. | — |
| padding | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8Tokenized padding shortcut. | — |
| margin | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8Tokenized margin shortcut. | — |
| asChild | booleanMerge props onto the immediate child instead of rendering the default element. | false |
| className | stringAdditional Tailwind classes merged with the component defaults. | — |