Skip to content
Home Theme Gallery

Spacing and radius

One scale, in rem, used for every gap, padding and margin the components apply:

TokenValueTypical use
--hui-space-2xs0.125rem2px — icon gaps inside a heading
--hui-space-xs0.25rem4px — title-to-description, badge gaps
--hui-space-sm0.5rem8px — label-to-control, button rows, table cell padding
--hui-space-md0.75rem12px — item inline padding, paragraph and heading spacing
--hui-space-lg1rem16px — card and empty-state padding, alert padding
--hui-space-xl1.5rem24px — dialog padding, list indent
--hui-space-2xl2rem32px — no component uses it; for host layout
The space scale

The scale is multiplicative, derived from one base:

--hui-radius: 0.45rem;
--hui-radius-sm: calc(var(--hui-radius) * 0.6); /* 0.27rem */
--hui-radius-md: calc(var(--hui-radius) * 0.8); /* 0.36rem */
--hui-radius-lg: var(--hui-radius); /* 0.45rem */
--hui-radius-xl: calc(var(--hui-radius) * 1.4); /* 0.63rem */
--hui-radius-2xl: calc(var(--hui-radius) * 1.8); /* 0.81rem */
--hui-radius-pill: 9999px;

That matters more than it looks. A subtractive scale (calc(radius - 2px)) collapses to zero at a small base radius and inverts into a negative value at a large one, so a host that sets --hui-radius: 0.2rem or 2rem gets broken corners. Multiplying keeps every step proportional at any base.

Small controls clamp their radius so they never read as pills by accident:

hui-button[size="sm"] button { border-radius: min(var(--hui-radius-md), 12px); }
The radius scale

Setting --hui-radius re-themes every rounded surface at once. Components read it as --hui-radius-lg, -md, -xl and so on, so the relationship holds.