Components / Layout and type
Box
Generic wrapper with token-based spacing and colors (MUI's Box). Prefer Stack/Grid for layout and Tailwind if you use it.
import { Box } from "@stylhero/ui";
Example
Code
import { Box } from "@stylhero/ui";
function BoxExample() {
return <Box p={4} radius="md" border bg="var(--surface-sunken)">A div with spacing, border and background props.</Box>;
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
as |
ElementType |
"div" |
|
bg |
string |
- | Any token color name, e.g. "surface-sunken" or "primary-soft". |
border |
boolean |
- | |
color |
string |
- | Text color token, e.g. "ink-muted". |
display |
CSSProperties["display"] |
- | |
m |
Space |
- | |
mb |
Space |
- | |
mt |
Space |
- | |
mx |
Space |
- | |
my |
Space |
- | |
p |
Space |
- | |
px |
Space |
- | |
py |
Space |
- | |
radius |
"sm" | "md" | "lg" | "full" |
- |
Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).
Types
type Space = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12;
Generated from src/components/Surface.tsx. Something wrong or missing? Open an issue.