Skip to main content

Dimension — The Orthogonal Layer

What is Dimension

Dimension is the orthogonal layer of Aplica DS. It runs in parallel to the Brand → Mode → Surface pipeline and feeds directly into the Semantic and Foundation layers.

While Brand, Mode, and Surface control visual identity (colors, typography, context), Dimension controls the spatial and typographic density of the interface.

Brand ──┐
Mode ─┼─────────────────────────────┐
Surface─┘ ▼
┌──────────────┐
│ Semantic │ ← where tokens gain purpose
└──────┬───────┘
Dimension ─────────────────────┘ │
(minor / normal / major) ▼
┌──────────────┐
│ Foundation │
└──────────────┘

Why does Dimension exist?

The same interface may need different densities depending on the use context:

ContextIdeal density
Dashboards and dense data interfacesminor — compact
General web and mobile applicationsnormal — standard
Reading, accessibility, large mobilemajor — spacious

Without Dimension, meeting these needs would require multiple separate token systems or hardcoded values. With Dimension, it is a variant switch.


Variants

The system supports three Dimension variants, each with its own DefaultDesignUnit:

VariantDefaultDesignUnitUse
minor8pxCompact interfaces, high density
normal16pxStandard — general use
major24pxSpacious — accessibility, reading

The DefaultDesignUnit is the anchor for the entire scale. Changing the variant changes all dimensional values proportionally.


Spatial Scale (Sizing and Spacing)

System constants

ConstantValue (for normal)Description
LayoutUnit4pxBase unit — all values are multiples of it
ScaleMultiplierFactor4Multiplier to derive the DefaultDesignUnit
DefaultDesignUnit16pxBase layout unit (1 DefaultDesignUnit = 1rem)

Progression rules

Above DefaultDesignUnit: Fibonacci-type progression

16, 28, 44, 72, 116 ... (each step = sum of the previous two, rounded to a LayoutUnit multiple)

Below DefaultDesignUnit down to LayoutUnit: LayoutUnit subtraction

12, 8, 4 (for LayoutUnit = 4, DefaultDesignUnit = 16)

Below LayoutUnit: divide by 2, rounded down

2, 1

Sizing includes 1px and 2px (for borders and strokes). Spacing starts at LayoutUnit (4px minimum).

Semantic sizing aliases

Semantic aliasValue (normal)Value (minor)Value (major)
zero000
pico1px1px1px
nano2px2px2px
micro4px2px6px
extraSmall8px4px12px
small12px6px18px
medium16px8px24px
large20px10px30px
extraLarge24px12px36px
mega28px14px42px
giga44px22px66px
tera72px36px108px
peta116px58px174px

Minor and major values are approximations — exact values depend on the specific params configuration for each variant.


Typographic Scale

The typographic scale is generated per variant and coexists with the dimension data in the same file (data/dimension/<variant>.json), under the _theme_typography key.

Font sizes — 13 steps

StepExponentValue (normal, ratio 1.2)
nano-48px
micro-310px
extraSmall-212px
small-114px
medium016px ← base
large+124px
extraLarge+224px
mega+332px
giga+440px
tera+540px
peta+648px
exa+764px
zetta+872px

Formula: size = DefaultDesignUnit × ratio^exponent

  • Above base: rounded to a multiple of LayoutUnit
  • Below base: rounded up (Math.ceil)

Default ratio: 1.2 (Minor Third) — globally configurable.

Line heights

Derived automatically from fontSizes via four densities:

DensityRatioUse
tight~1.2Headings, titles
close~1.35Subtitles
regular~1.5Standard body text
wild~1.8Long-form reading, accessibility

Letter spacing

Three fixed values, independent of variant:

NameValueUse
tight-0.72Large headings
regular0Default
wild+0.8All-caps text, labels

Output Units

Dimension is stored in px but the output depends on the platform:

FormatUnitReason
CSSremAccessibility — scales with the user's font preference (WCAG 1.4.4)
JSONpxFigma and Tokens Studio work with integer px values
JS / ESMpxNumeric precision for JavaScript calculations

Exception: semantic.depth.spread remains in px across all formats (it is not a dimensional token in the semantic sense — it is a raw number for box-shadow).

CSS formula: rem = px / baseFontSize where baseFontSize default = 16.


Raw scale structure and step rule

The scale is stored as a flat key-value map inside data/dimension/<variant>.json. Each key is an integer step number; the value is the pixel dimension for that step given the variant's LayoutUnit.

Step rule (as of 2.22.4):

RangeStep
0 – 100Variable (0, 6, 12, 25, 50, 75, 100)
above 10025 (100, 125, 150, 175, 200, 225, 250, 275 … 800)

Breaking change (2.22.4): Before this version, keys above 100 used step 5 (100, 105, 110, … 800). Steps 105, 110, 115, … 795 no longer exist. Consumers that reference dimension.scale.105, dimension.scale.110, etc. explicitly must migrate to the nearest step in the new series.

The step-25 rule ensures that above 100, every scale value is always a multiple of 4px (with LayoutUnit = 4), eliminating non-round values (17px, 18px, 19px) and key collisions.

semantic.giga change (2.22.4): Moved from dimension.scale.200 (was 32px in Normal) to dimension.scale.275 (44px in Normal), aligning with the expected semantic sizing. Consumers using semantic.giga are unaffected; consumers referencing the raw dimension.scale.200 key must update to dimension.scale.275 if they intended giga.


File generated per variant

Each variant generates a file in data/dimension/<variant>.json with two sections:

{
"dimension": {
"scale": { ... }, ← raw numerical scale (keys: 0, 25, 50, 75, 100, 125, 150, ...)
"semantic": {
"sizing": { ... }, ← semantic sizing aliases
"spacing": { ... } ← semantic spacing aliases
}
},
"_theme_typography": {
"fontSizes": { ... }, ← font size scale
"lineHeights": { ... }, ← derived line heights
"letterSpacings": { ... } ← letter spacings
}
}

At build time, _theme_typography is merged with the brand's _typography.json (which contributes fontFamilies, fontWeights, textDecoration, textCases) to form the complete set of typographic tokens.


Overrides and Extensibility

Scale values can be overridden per variant via getOverrides(variant) in config/global/dimension.config.mjs.

Mandatory rule: any custom value must be a multiple of LayoutUnit.

value % LayoutUnit === 0 // must be true

Semantic tokens must always reference steps from the scale (or valid overrides). Never values that break the grid.


Configuration

Dimension is configured in config/global/themes.config.json:

{
"global": {
"dimension": {
"outputUnit": {
"css": "rem",
"default": "px"
},
"baseFontSize": 16,
"params": {
"minor": { "layoutUnit": 2, "scaleMultiplierFactor": 4 },
"normal": { "layoutUnit": 4, "scaleMultiplierFactor": 4 },
"major": { "layoutUnit": 6, "scaleMultiplierFactor": 4 }
}
},
"typography": {
"fontSizeScaleRatio": 1.2
}
}
}

References

  • Token Architecture
  • Implementation: references/aplica-tokens-theme-engine/dynamic-themes/scripts/dimension-scale.mjs
  • Configuration: references/aplica-tokens-theme-engine/config/global/dimension.config.mjs
  • Technical documentation: references/aplica-tokens-theme-engine/docs/context/dimension/