Layout
Box, Stack, Inline, Grid and Container: spacing from tokens, no custom CSS.
Staticimport { Box } from 'umbra-ui'
Props
Box
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | div | Element or component to render. |
bordered | boolean | false | Draws the standard 1px border. |
padding | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | — | Padding on all sides, as a spacing token step. |
paddingX | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | — | Horizontal padding; overrides `padding` on that axis. |
paddingY | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | — | Vertical padding; overrides `padding` on that axis. |
radius | "sm" | "md" | "lg" | "xs" | "full" | — | Corner radius token. |
surface | "bg" | "bg-subtle" | "surface-1" | "surface-2" | "surface-3" | — | Background layer token. |
Stack
| Prop | Type | Default | Description |
|---|---|---|---|
align | "center" | "start" | "end" | "stretch" | "baseline" | center | Cross-axis alignment. |
as | ElementType | div | Element or component to render. |
gap | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | 4 | Space between children, as a spacing token step. |
justify | "center" | "start" | "end" | "between" | start | Main-axis distribution. |
Inline
| Prop | Type | Default | Description |
|---|---|---|---|
align | "center" | "start" | "end" | "stretch" | "baseline" | center | Cross-axis alignment. |
as | ElementType | div | Element or component to render. |
gap | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | 4 | Space between children, as a spacing token step. |
justify | "center" | "start" | "end" | "between" | start | Main-axis distribution. |
wrap | boolean | true | Allow children to wrap onto new lines. |
Grid
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | div | Element or component to render. |
columns | string | number | 1 | Fixed number of equal columns, or any `grid-template-columns` value. Ignored when `minItemWidth` is set. |
gap | "0" | "10" | "0.5" | "1" | "1.5" | "2" | "3" | "4" | "5" | "6" | "8" | "12" | "16" | 4 | Space between cells, as a spacing token step. |
minItemWidth | string | — | Responsive mode: fit as many columns as possible, each at least this wide (CSS length). |
Container
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | div | Element or component to render. |
size | "sm" | "md" | "lg" | "xl" | lg | Maximum content width. |
Usage notes
gap and padding take spacing token steps ("4" is 16px). Every primitive accepts as.
Accessibility
- Layout primitives add no semantics: use
asfor landmarks (as="main",as="nav").
Import
import { Box, Stack, Inline, Grid, Container } from 'umbra-ui';
import 'umbra-ui/styles.css'; // once, at the root of your app