Search the documentation

Type to search page titles, component names and descriptions.

    Other

    Contract

    The `data-ui` hooks a consumer may rely on.

    Every element a component renders carries a data-ui hook. HOOKS lists them all and OWNERS names the component each belongs to. A hook's look is decided in the design system, never a second time in a host stylesheet.

    #When to use

    • Select a hook in tests and in application behaviour; do not restyle it.
    • faifo-design/contract also exports the ratchet a consumer runs over its own stylesheets (designSystemHookRestyles, hookRestyleRatchet) so restyles of design-system elements can only become fewer.

    #Contract

    #Hook ownership ratchet

    A data-ui hook listed in HOOKS (from faifo-design/contract) is the component's: its look is decided in the design system, never a second time in a host stylesheet. designSystemHookRestyles(css, HOOKS) reports every rule outside the design system whose subject is such a hook and that declares anything on it; custom properties (tokens the component reads) and rules whose subject is the application's own element ([data-ui="x"] .mine, .row:has([data-ui="x"])) are not counted.

    Existing restyles are frozen in a baseline, one sorted hook list per stylesheet, and hookRestyleRatchet + formatHookRatchet fail on both directions: a (file, hook) pair the baseline does not list, and a baseline entry the file no longer restyles. The baseline only shrinks. When the check fails on a new pair, change the component here (its styles, a variant or a prop) instead of adding the pair. A host helper whose markup carries a design-system hook (data-ui="stack", "inline", "code", "count-badge", the spinner of a loading action) renders the public component instead of markup of its own with the same name; two owners for one hook is what produces the restyle. A helper gap without a matching size maps to the nearest token (the backend kit's compact stack is tight). A change that adds the same pair to a stylesheet and to the baseline passes that check, so on a pull request to develop the design-system-layout workflow also runs hookBaselineGrowth + formatHookBaselineGrowth against the merge base with the target branch (HOOK_BASELINE_BASE_REF), and any entry the merge base's baseline does not list fails. Until the target branch has a baseline, the reference is the fixed copy at the commit that introduced it (BOOTSTRAP_COMMIT in both tests), never the baseline the change itself brings; a missing reference fails instead of passing. Merge that commit with a merge commit so it stays reachable.

    A hook is selected by any attribute form that matches it: [data-ui="x"], the i flag, ~=, |=, ^=, $=, *= and a bare [data-ui] (every hook). The conditions of one compound hold at once, so [data-ui][data-ui="app-widget"] selects only the application's app-widget. The arguments of :is(), :where() and the of list of :nth-child()/:nth-last-child() count through their own subject, so :is([data-ui="x"] .mine) styles .mine, not x. Rules inside @starting-style count like any other.

    In this workspace, test/design-system-hook-ratchet.test.ts scans every tracked stylesheet under packages/ against test/design-system-hook-baseline.json. Two packages are excluded by owner decision (26-11-2026): flow-ui and flow-client keep their own stylesheet for the open-core Flow kit. An application runs the same functions over its own stylesheets with its own baseline.

    Client compositions of createRelationSelectView can call getSelectedValues() to obtain an isolated array of selected opaque IDs, including IDs containing commas. Use this method for JSON commands instead of parsing the legacy native CSV value. Native form reset restores the configured initial selection, including forms inserted after mounting the picker. The disposable runtime removes its form listener.

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #HOOKSConstant

    const HOOKS = [...new Set(Object.values(GROUPS).flat())].sort()

    #OWNERSConstant

    const OWNERS = Object.freeze( Object.fromEntries(Object.entries(GROUPS).map(([owner, hooks]) => [owner, [...hooks]])), )