variable / @typed/ui

Composite.StateSchema

Effect Schema used by makeState to encode, decode, and hydrate Composite state.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Active item state
Since
1.0.0
Member of
Composite

Import

import { Composite } from "@typed/ui";

Access Composite.StateSchema through the imported Composite export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare const StateSchema: Schema.Struct<{
    readonly activeId: Schema.NullOr<Schema.String>;
    readonly orientation: Schema.Literals<readonly [
        "horizontal",
        "vertical",
        "both"
    ]>;
    readonly loop: Schema.Boolean;
    readonly rtl: Schema.Boolean;
    readonly virtualFocus: Schema.Boolean;
}>;

Why

A public schema makes hydration and serialized state use the same runtime validation as direct construction.

Ownership and lifetime

This declaration is data or schema metadata and acquires no resources.

Examples

import * as Schema from "effect/Schema";
import * as Composite from "@typed/ui/Composite";

const decodeState = Schema.decodeUnknownEffect(Composite.StateSchema);

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source