Four layers. Values flow one way — down. No layer reaches past the one above it.
belin/tokens/primitives.cssNamed by what they are, not what they do. The only place actual hex or rem values live. Nothing else in the system contains raw numbers.
Colors
Spacing
Radius
Shadow
Type scale
Fonts
belin/tokens/semantics.css + dark.cssNamed by role, not value. References primitives only — never raw numbers. Same token names in both modes: components never need to check which mode is active.
:root { } — Light defaults
.dark { } — Dark overrides
Radius, fonts, and type scale inherit light defaults.
density.css — [data-density] presets
compact / default / comfortable each map these four to different primitives.
component-spacing.css — Button slot
Baseline values; ComponentStylesProvider overrides per size at runtime.
text-styles.css — .ts-{slug} classes
Each class reads --ts-{slug}-* variables with fallbacks to the type scale. TextStyleProvider injects overrides on mount.
Runtime overrides — injected ‹style› tags (sit above the defaults above)
shadcn bridge — maps Belin names to the names shadcn components expect
belin/components/Thin wrappers around shadcn source. Reference semantic tokens only — never primitives directly. App code imports from @/belin/components — never from @/components/ui. Density (compact / default / comfortable) comes from the data-density attribute on <html>.
Wrapped components
Button — tokens consumed
Typography — tokens consumed
belin/tokens/component-variants.tsNamed token configurations bound to a specific component. The customizer's Button editor stores per-variant color references and per-size spacing + radius references. ComponentStylesProvider compiles these to CSS at runtime and writes them to the variant style tag — no instance overrides, no per-component CSS token layer.
Button variants — color references stored per variant
Button sizes — spacing references stored per size × density
Each cell stores top/right/bottom/left as references to --belin-space-* tokens. Radius is stored once per size and references --radius-{sm|md|lg}.
How a raw value travels from a hex number in primitives.css all the way to a rendered component.
Primary button background
Button padding (default size, default density)
Heading 2 font size
Page background (dark mode)
Not shown: belin/tokens/base.css — component-critical CSS that ships alongside the tokens (Base UI overlay fixes, Belin variant defaults, table chrome, and the shadcn variable bridge). It consumes tokens but defines none, so it sits outside the four layers above.