Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

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

PropTypeDefaultDescription
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.