stax-monorepo
    Preparing search index...

    Interface MatchConfig<A, E, R, E2, R2, N>

    Configuration for the match control flow (DOM-specific with animation support).

    interface MatchConfig<
        A,
        E = never,
        R = never,
        E2 = never,
        R2 = never,
        N extends DOMElement = DOMElement,
    > {
        animate?: AnimationOptions;
        cases: readonly MatchCase<A, E, R>[];
        container?: () => Element<N, never, never>;
        extractPattern?: (value: A) => unknown;
        fallback?: () => Element<DOMElement, E2, R2>;
        intro?: boolean;
    }

    Type Parameters

    • A
    • E = never
    • R = never
    • E2 = never
    • R2 = never
    • N extends DOMElement = DOMElement

      The container element type. Inferred from container if provided; defaults to HTMLElement | SVGElement otherwise.

    Index

    Optional animation configuration

    cases: readonly MatchCase<A, E, R>[]

    Array of pattern-render pairs

    container?: () => Element<N, never, never>

    Optional custom container element. If not provided, defaults to a div with display: contents.

    extractPattern?: (value: A) => unknown

    Optional function to extract the pattern from the value for matching. Use this when the value contains additional information for change detection (like a path) but the pattern matching should use a subset (like route name).

    match(routeWithPath, {
    cases: [{ pattern: "users", render: () => UsersPage() }],
    extractPattern: (value) => value?.split("::")[0], // "users::/users/1" -> "users"
    })
    fallback?: () => Element<DOMElement, E2, R2>

    Optional fallback if no pattern matches

    intro?: boolean

    Re-animate the SSR/SSG-rendered case on hydration. See EachConfig.intro for the full contract and FOUC caveat.