PRIMITIVES
Box
Polymorphic flex primitive. Use it whenever you need a flex container with type-checked direction, gap, alignment and justification — and the option to render as any HTML element via as.
Import
Row layout
OneTwoThree
Column layout
TopMiddleBottom
Polymorphic — render as any element
Pass as to render Box as a different tag while keeping the layout utilities. Useful for landmark elements (<section>, <header>, <aside>) or to forward to a Next Link.
Props
Box props
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType | 'div' | Polymorphic element. Pass any HTML tag or component (section, header, aside, Link, …) and Box keeps its layout utilities while delegating semantics to the chosen element. |
| direction | 'row' | 'row-reverse' | 'column' | 'column-reverse' | 'row' | Sets flex-direction. |
| gap | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 0 | Tailwind spacing step applied to the flex container gap. |
| align | 'start' | 'center' | 'end' | 'stretch' | 'baseline' | 'stretch' | align-items. |
| justify | 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' | 'start' | justify-content. |
| wrap | 'wrap' | 'nowrap' | 'wrap-reverse' | 'nowrap' | flex-wrap. |
| inline | boolean | false | Switch to inline-flex when the box must sit inline with text. |
| className | string | — | Tailwind classes are merged on top of the variant defaults. |