Search the documentation

Type to search page titles, component names and descriptions.

    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:

    1. Reference (--faifo-ref-*): the raw palette, such as --faifo-ref-white or --faifo-ref-surface-1. Only tokens.css reads these.
    2. Semantic (--faifo-page-bg, --faifo-accent-text, --faifo-panel-border, …): what a colour is for, in light and dark through light-dark().
    3. 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 in tokens.css. A presentation such as grouped rebinds 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-*:

    TokenValueHolds
    --faifo-layer-base0the page itself
    --faifo-layer-sticky10sticky page chrome
    --faifo-layer-menu40menus and filter panels
    --faifo-layer-popover50popovers, tooltips, pickers
    --faifo-layer-dialog100modal dialogs and drawers
    --faifo-layer-dock150docks (a call runs across dialogs)
    --faifo-layer-toast200toasts

    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():

    TokenUsed by
    --faifo-shadow-controlthe hairline under a resting Button
    --faifo-shadow-xs, --faifo-shadow-smsmall raised parts, such as a switch thumb
    --faifo-shadow-mda raised Surface or ContentCard
    --faifo-shadow-popover, --faifo-shadow-floatmenus, popovers, pickers, toasts, docks
    --faifo-shadow-dialogModal, 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

    TokenValueGroup
    --faifo-shadow-xs0 1px 2px light-dark(rgb(24 26 31 / 8%), rgb(0 0 0 / 32%))Elevation and layers
    --faifo-shadow-sm0 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-md0 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-popover0 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-floatvar(--faifo-shadow-popover)Elevation and layers
    --faifo-shadow-dialog0 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-control0 1px 1px light-dark(rgb(24 26 31 / 6%), rgb(0 0 0 / 26%))Elevation and layers
    --faifo-shadow-control-highlightinset 0 1px 0 rgb(255 255 255 / 14%)Elevation and layers
    --faifo-layer-base0Elevation and layers
    --faifo-layer-sticky10Elevation and layers
    --faifo-layer-menu40Elevation and layers
    --faifo-layer-popover50Elevation and layers
    --faifo-layer-dialog100Elevation and layers
    --faifo-layer-dock150Elevation and layers
    --faifo-layer-toast200Elevation and layers
    --faifo-layer-local-below-1Elevation and layers
    --faifo-layer-local-raised1Elevation and layers
    --faifo-layer-local-overlay2Elevation and layers
    --faifo-layer-local-edge3Elevation and layers
    --faifo-z-basevar(--faifo-layer-base)Elevation and layers
    --faifo-z-stickyvar(--faifo-layer-sticky)Elevation and layers
    --faifo-z-dropdownvar(--faifo-layer-menu)Elevation and layers
    --faifo-z-popovervar(--faifo-layer-popover)Elevation and layers
    --faifo-z-modalvar(--faifo-layer-dialog)Elevation and layers
    --faifo-z-dockvar(--faifo-layer-dock)Elevation and layers
    --faifo-z-toastvar(--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.

    TokenValueGroup
    --faifo-duration-fast100msMotion
    --faifo-duration-normal160msMotion
    --faifo-duration-slow240msMotion
    --faifo-ease-defaultcubic-bezier(0.2, 0, 0, 1)Motion
    --faifo-ease-outcubic-bezier(0, 0, 0.2, 1)Motion
    --faifo-motion-fastvar(--faifo-duration-fast) var(--faifo-ease-default)Motion
    --faifo-motion-normalvar(--faifo-duration-normal) var(--faifo-ease-default)Motion