Usage
Box is the foundational layout container: padding, margin, gap, display modes, alignment, borders, backgrounds, sizing, and positioning hooks. It carries no semantic meaning on its own—it organizes content. The mental model is “styled rectangle,” not “interactive control.”
Box is configured by props rather than named visual variants. Common combinations:
| Configuration | Purpose | Emphasis |
|---|---|---|
FlexBox alias | Shorthand flex container | Still token-driven gaps and alignment |
| Padding / margin scales | Rhythm | Prefer axis shorthand when horizontal and vertical differ |
| Background + border | Card-like regions | Don’t mimic interactive cards without proper focus semantics |
| Positioned overlays | Contextual layers | Manage zIndex with design tokens; avoid arbitrary stacks |
Box renders a container around children. Nesting Boxes is normal; keep depth readable. FlexBox is Box with flex display preset—choose it to reduce boilerplate, not to change semantics.
gap and wrapping over fixed widths when content varies.onClick alone without accessibility parity.Do
zIndex, Background, and Border rather than raw values.Don’t
overflow: hidden), verify keyboard users can still reach hidden interactive elements or provide another path.