Skip to content

Density, type, and roundness ​

GHO-66 recipes on top of the token catalog. Components consume semantic --ghost-* variables. There are no per-component tokens.

Unset data-ghost-density is comfortable. data-ghost-density nests on any subtree the same way data-ghost-mode does: a descendant attribute overrides the ancestor. --ghost-roundness (0–1, default 1) is a CSS custom property on any subtree; every radius token is calc(<designed> * var(--ghost-roundness, 1)).

Spacing ​

The primitive scale is 4px (0, 1 = 4px, 2 = 8px, through 16 = 64px), with half-steps 0_5 (2px), 1_5 (6px), and 2_5 (10px) for control padding. Semantic roles are space.gap.*, space.inset.*, and space.stack.*. Density remaps those roles one step down (compact) or up (spacious). Compact space.gap.xs is 0, so spacing roles never size paint. Painted geometry uses track.thickness.* (4 / 6 / 8px), track.thumb.* (12 / 16 / 20px), and track.target (24px minimum hit size), which stay fixed at every density and theme. GhostProgress and GhostSlider read these.

Control heights ​

Heights are the five-step Precision SaaS scale 28 / 32 / 36 / 40 / 44px. Size and density map onto that scale:

Sizecompactcomfortable (default)spacious
sm28px32px36px
md32px36px40px
lg36px40px44px

Control padding and font size step alongside height:

Sizecompact (font / padding)comfortable (font / padding)spacious (font / padding)
sm12px / 2px × 8px13px / 4px × 10px13px / 6px × 12px
md13px / 4px × 10px14px / 6px × 12px15px / 8px × 16px
lg14px / 6px × 12px15px / 8px × 16px16px / 10px × 20px

Themed controls that sit in a row with other controls read this scale instead of carrying their own padding, so a toolbar lines up without overrides. GhostButton, GhostInput, GhostSelect, GhostCombobox, the GhostDatePicker inputs and trigger, GhostTabs triggers, the GhostFileUpload trigger, and the GhostSegmentedControl and GhostToggleGroup tracks are one md control tall by default. Denser parts use the sm step: menu and listbox items, GhostMenubar triggers, GhostScrollSpy links, and GhostCalendar days and month buttons.

@media (pointer: coarse) floors every control minimum to 44px (control.touch, 2.75rem) so touch targets do not shrink with compact, comfortable, or small sizes. Fine pointers keep the mapped height.

Radius follows the same density step (4px / 6px / 8px for action.radius and radius.md), then multiplied by --ghost-roundness.

Type ​

UI sizes (type.size.xs–lg: 12 / 13 / 14 / 15px) resolve to crisp deterministic rem values; display heading sizes (type.size.xl–3xl) use fluid clamp() from 320px–1280px viewports. The stack is system UI only (ui-sans-serif, system-ui, sans-serif plus emoji fallbacks). No web font.

TokenCSSUse
type.family.sans--ghost-type-family-sansSystem sans
type.family.mono--ghost-type-family-monoSystem monospace (code)
type.size.xs–lg--ghost-type-size-*Crisp UI rem scale (12–15)
type.size.xl–3xl--ghost-type-size-*Fluid display scale
type.letter.tight--ghost-type-letter-tight-0.02em
type.letter.normal--ghost-type-letter-normal0em
type.letter.wide--ghost-type-letter-wide0.04em
type.numeric.tabular--ghost-type-numeric-tabularfont-variant-numeric
type.feature.default--ghost-type-feature-defaultkern / liga / calt
type.feature.tabular--ghost-type-feature-tabulartnum plus kerning
css
.price {
  font-variant-numeric: var(--ghost-type-numeric-tabular);
  font-feature-settings: var(--ghost-type-feature-tabular);
}

Prose type.size.* tokens do not change with density, while interactive controls (GhostButton, GhostInput, GhostSelect, and peers) scale label size with density through control.size.*.font (medium weight 500 on action.label.weight).

Roundness ​

css
.product-theme {
  --ghost-roundness: 0.35;
}

.chip {
  border-radius: var(--ghost-radius-pill);
}
--ghost-roundnessEffect
0Sharp. Every radius token computes to 0.
1 (default)Designed radii. radius.pill is a capsule.
betweenLinear scale of each token’s designed value.

Set the knob on any subtree. Radius calc() is redeclared on descendants so a nested --ghost-roundness re-evaluates, matching --ghost-motion-intensity.

Live demo ​

Density and roundness on this card. Nested data-ghost-density inside a comfortable page still wins.

xsBody uses crisp type.size.md.12,345.00

Playground ​

The playground Density, type, and roundness section has the same controls plus a matrix of every density × roundness 0 / 0.5 / 1 used by browser snapshots.