Box
The sanctioned escape hatch — a raw host element with a className, still
policed by tokens-only. Box renders the chosen {@link LayoutElement} with
ZERO opinions of its own (no margin, width, or padding, unlike Container), so
it is the honest neutral node for decorative wrappers that a styled primitive
would visually break. Reach for it only when no styled primitive fits; the
className you pass is governed by the same tokens-only scan as everything
else. RSC-safe.
Zero-opinion wrapper
Usage
import { Box, BoxProps } from "@desk/ui/components/box";Best practices
Boxrenders the chosen element with ZERO layout opinions (no margin/width/padding, unlikeContainer) — the honest wrapper when a styled primitive would visually interfere.Use
as="span"for a decorative inline wrapper; reach forBoxonly when no styled primitive fits — itsclassNameis still tokens-only policed.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| as | "div" | "li" | "nav" | "ol" | "span" | "ul" | "article" | "aside" | "figcaption" | "figure" | "footer" | "header" | "main" | "section" | Render as a different host element from the closed layout vocabulary
({@link LayoutElement}). The set is deliberately closed: |
Also exports
- interface
BoxProps
Composition
Used by