Inheritance

Examples showing where inherit hooks participate in runtime styling, and how explicit component values now take precedence over inherited fallbacks.

Each example is split into tabs so you can inspect the live preview, the Blade usage, and the implementation pattern that resolves the precedence.

Resolution order

  • 1. Check whether the component instance sets its own custom property such as `--c-button--*`, `--c-field--*`, or a derived alias like `--c-typography--font-size-lead`.
  • 2. If no explicit component value exists, consume the matching `--inherit-*` variable from the surrounding context.
  • 3. If neither exists, fall back to the token-backed `-default` variable or token helper result.

Live examples

Button token inheritance

The container publishes inherit hooks for surface and contrast. The first button consumes those values. The second button sets explicit component variables, so its customization wins over the inherited values.

Field explicit-var-first chain

Field background color is resolved with an explicit CSS variable chain. In this example the inherited case uses the secondary color, while the second field keeps the same inherited context but overrides the component background with a different value.

Implementation patterns

Use the helper that matches the type of value you are resolving. Direct token-backed component variables use token helpers, derived aliases use the alias helper, and non-token runtime variables can keep an explicit CSS fallback chain.

background-color: tokens.getRawValue(
    $prefix: $_,
    $token: 'color--surface',
    $inheritVariable: 'color-background'
);