Skip to documentation

Design system / Sources & standards

Current repository source

ADR-0034-fluid-typography-scale-and-semantic-contract.md

docs/decisions/ADR-0034-fluid-typography-scale-and-semantic-contract.md

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

# ADR-0034: Fluid typography scale and application contract

## Status

accepted

**Partial supersession:** [ADR-0086](ADR-0086-semantic-reading-rhythms.md) supersedes only this ADR's line-height prescription. Fluid font sizes, proportional hierarchy, semantic size roles, Tailwind mappings and shared-UI size defaults remain accepted. Line-height values are adjustable theme details; tight and loose reading rhythms may coexist.

## Date

2026-07-15

## Context

CreativeXHub's administrative interfaces need a readable but compact type system from mobile viewports through large desktop displays. Tailwind v4 uses the `--text-*` namespace for active `text-*` utilities; the previous `--font-size-*` bridge left the application on Tailwind defaults against the 10px root. Generic utility names also did not express whether content was microcopy, a control label, supporting prose, or primary readable content.

## Options considered

- Continue using fixed or default Tailwind text utilities.
- Require an all-at-once component migration before applying a scale.
- Use a fluid primitive scale as the active Tailwind contract, with semantic role utilities for purposeful component migration.

## Decision

- Add a fluid type primitive scale under `--cxh-type-size-*`.
- Define `--cxh-type-size-md` as `clamp(1.45rem, calc(1.3927rem + 0.1591vw), 1.8rem)`, which interpolates from 14.5px at 360px to 18px at 2560px with the 10px rem basis.
- Derive every other primitive step from medium using the minor-third ratio of 1.2, preserving proportional hierarchy at all viewport widths.
- Define compact unitless line-height primitives by role: heading `1.1`, title `1.2`, body `1.4`, and label `1.2`.
- Map Tailwind v4 `text-xs` through `text-6xl` utilities to the primitive scale through the active `--text-*` namespace, and expose `text-jumbo` for the largest step.
- Expose independent semantic tokens and utilities: `text-body`, `text-supporting`, `text-label`, `text-eyebrow`, and `text-title`. The supporting utility intentionally differs from the underlying `--text-secondary` size token to avoid Tailwind's `text-secondary` color utility.
- Treat `text-md` and `text-body` as the readable medium base. Shared controls, navigation, menus, and table content default to `text-md`; compact variants, shortcuts, badges, identifiers, and table headers intentionally remain smaller.

## Rationale

The 10px rem basis makes the scale legible in design and implementation. Deriving each step from one fluid medium token keeps hierarchy constant instead of allowing individual viewport formulas to drift. Keeping line-height unitless makes its rendered value grow and shrink with the associated font size. Applying the actual Tailwind v4 namespace gives the current application a coherent default, while semantic roles make content intent explicit.

## Consequences

- New UI should consume semantic role utilities when the role is clear rather than introduce hard-coded font sizes.
- Generic Tailwind `text-*` utilities remain available for foundation components and cases without a stable semantic role.
- The token contract is a design foundation owned by `src/theming/`; it introduces no route, authorization, or client-state behavior.
- Future changes to the scale or role mapping require review as a theme-wide visual change.

## Related decisions

- Extends ADR-0030's primitive/semantic token architecture without superseding it.
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.