Design
Elevation and layers
Three token tiers, one layer scale and scheme-aware shadows.
Tokens come in three tiers, all declared in src/foundations/tokens.css:
- Reference (
--faifo-ref-*): the raw palette, such as--faifo-ref-whiteor--faifo-ref-surface-1. Onlytokens.cssreads these. - Semantic (
--faifo-page-bg,--faifo-accent-text,--faifo-panel-border, …): what a colour is for, in light and dark throughlight-dark(). - Component (
--faifo-action-logo-stage,--faifo-qr-code-ink,--faifo-grouped-*,--faifo-flat-bg, …): a role that belongs to one component or presentation, still declared intokens.css. A presentation such asgroupedrebinds semantic roles to its component tokens.
Component CSS reads only semantic and component tokens: no --faifo-ref-*, no hex colour, no
numeric z-index. The exceptions sit outside CSS and are deliberate: QrCode writes a white
quiet-zone rect into its server-rendered SVG (fill="#fff") so a copied or printed code still
scans, and the Lightbox specimen pictures (demo.ts) are sample images, not interface colour.
test/design-system-layer-colour-tokens.test.ts fails when component CSS reintroduces
any of them.
Stacking uses one scale, --faifo-layer-*:
| Token | Value | Holds |
|---|---|---|
--faifo-layer-base | 0 | the page itself |
--faifo-layer-sticky | 10 | sticky page chrome |
--faifo-layer-menu | 40 | menus and filter panels |
--faifo-layer-popover | 50 | popovers, tooltips, pickers |
--faifo-layer-dialog | 100 | modal dialogs and drawers |
--faifo-layer-dock | 150 | docks (a call runs across dialogs) |
--faifo-layer-toast | 200 | toasts |
Inside one component's own stacking context (a grid's pinned cells, an editor over its cell)
use the local steps --faifo-layer-local-below (-1), --faifo-layer-local-raised (1),
--faifo-layer-local-overlay (2) and --faifo-layer-local-edge (3); they never compete with the
page-level layers. A layer just above or below another is calc() on the token
(calc(var(--faifo-layer-dialog) - 1)). The first names --faifo-z-base, --faifo-z-sticky,
--faifo-z-dropdown, --faifo-z-popover, --faifo-z-modal, --faifo-z-dock and --faifo-z-toast remain as
deprecated aliases of the matching --faifo-layer-* token for existing consumers.
Elevation is one scale of layered, scheme-aware shadows. Every step pairs a tight contact
shadow with a wide ambient one and picks its colour per scheme with light-dark():
| Token | Used by |
|---|---|
--faifo-shadow-control | the hairline under a resting Button |
--faifo-shadow-xs, --faifo-shadow-sm | small raised parts, such as a switch thumb |
--faifo-shadow-md | a raised Surface or ContentCard |
--faifo-shadow-popover, --faifo-shadow-float | menus, popovers, pickers, toasts, docks |
--faifo-shadow-dialog | Modal, Dialog and ConfirmDialog above the scrim |
A working surface has no shadow unless it opts into raised. A Button is the only resting control with depth; a
Field stays flat, so what is pressed and what is typed into read differently. Control strokes
and focus halos are inset or spread box shadows, so state never moves geometry; under
forced-colors: active Button and Field redraw them as outlines. A focused invalid Field
keeps its danger stroke and reads --faifo-focus-ring-danger for its halo.
In dark, surfaces rise in steps: canvas, sidebar and rail, panel, then controls and raised
surfaces, each lighter than the one under it. A disabled control is the exception:
--faifo-interactive-disabled is a translucent white veil there (an opaque grey in light), so it
stays visible on any of those surfaces. Use it as a fill over a surface, never to cover content.
#Elevation and layer tokens
| Token | Value | Group | |
|---|---|---|---|
--faifo-shadow-xs | 0 1px 2px light-dark(rgb(24 26 31 / 8%), rgb(0 0 0 / 32%)) | Elevation and layers | |
--faifo-shadow-sm | 0 1px 2px light-dark(rgb(24 26 31 / 7%), rgb(0 0 0 / 30%)), 0 2px 6px -1px light-dark(rgb(24 26 31 / 9%), rgb(0 0 0 / 34%)) | Elevation and layers | |
--faifo-shadow-md | 0 2px 4px -2px light-dark(rgb(24 26 31 / 8%), rgb(0 0 0 / 32%)), 0 8px 20px -4px light-dark(rgb(24 26 31 / 14%), rgb(0 0 0 / 42%)) | Elevation and layers | |
--faifo-shadow-popover | 0 2px 6px -2px light-dark(rgb(24 26 31 / 10%), rgb(0 0 0 / 38%)), 0 12px 32px -6px light-dark(rgb(24 26 31 / 20%), rgb(0 0 0 / 54%)) | Elevation and layers | |
--faifo-shadow-float | var(--faifo-shadow-popover) | Elevation and layers | |
--faifo-shadow-dialog | 0 4px 12px -4px light-dark(rgb(24 26 31 / 12%), rgb(0 0 0 / 42%)), 0 24px 56px -12px light-dark(rgb(24 26 31 / 30%), rgb(0 0 0 / 64%)) | Elevation and layers | |
--faifo-shadow-control | 0 1px 1px light-dark(rgb(24 26 31 / 6%), rgb(0 0 0 / 26%)) | Elevation and layers | |
--faifo-shadow-control-highlight | inset 0 1px 0 rgb(255 255 255 / 14%) | Elevation and layers | |
--faifo-layer-base | 0 | Elevation and layers | |
--faifo-layer-sticky | 10 | Elevation and layers | |
--faifo-layer-menu | 40 | Elevation and layers | |
--faifo-layer-popover | 50 | Elevation and layers | |
--faifo-layer-dialog | 100 | Elevation and layers | |
--faifo-layer-dock | 150 | Elevation and layers | |
--faifo-layer-toast | 200 | Elevation and layers | |
--faifo-layer-local-below | -1 | Elevation and layers | |
--faifo-layer-local-raised | 1 | Elevation and layers | |
--faifo-layer-local-overlay | 2 | Elevation and layers | |
--faifo-layer-local-edge | 3 | Elevation and layers | |
--faifo-z-base | var(--faifo-layer-base) | Elevation and layers | |
--faifo-z-sticky | var(--faifo-layer-sticky) | Elevation and layers | |
--faifo-z-dropdown | var(--faifo-layer-menu) | Elevation and layers | |
--faifo-z-popover | var(--faifo-layer-popover) | Elevation and layers | |
--faifo-z-modal | var(--faifo-layer-dialog) | Elevation and layers | |
--faifo-z-dock | var(--faifo-layer-dock) | Elevation and layers | |
--faifo-z-toast | var(--faifo-layer-toast) | Elevation and layers |
#Motion
Motion is short and purposeful: --faifo-duration-fast (100ms), -normal (160ms) and -slow
(240ms) with --faifo-ease-default. --faifo-motion-fast and --faifo-motion-normal combine a
duration with the easing. Under prefers-reduced-motion: reduce the three durations collapse, so
every transition that reads them stops animating.
| Token | Value | Group | |
|---|---|---|---|
--faifo-duration-fast | 100ms | Motion | |
--faifo-duration-normal | 160ms | Motion | |
--faifo-duration-slow | 240ms | Motion | |
--faifo-ease-default | cubic-bezier(0.2, 0, 0, 1) | Motion | |
--faifo-ease-out | cubic-bezier(0, 0, 0.2, 1) | Motion | |
--faifo-motion-fast | var(--faifo-duration-fast) var(--faifo-ease-default) | Motion | |
--faifo-motion-normal | var(--faifo-duration-normal) var(--faifo-ease-default) | Motion |