function / @typed/ui/index

Form.StateSchema

Builds the serializable schema for a form’s hydrated state.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Hydration schemas
Since
1.0.0
Member of
Form

Import

import { Form } from "@typed/ui/index";

Access Form.StateSchema through the imported Form 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 function StateSchema<const Fields extends FormFields>(codec: Schema.Struct<Fields>): Schema.Struct<{
    readonly values: Schema.Struct<Fields>;
    readonly defaultValues: Schema.Struct<Fields>;
    readonly errors: Schema.Struct<OptionalFields<Fields, Schema.String>>;
    readonly meta: Schema.Struct<OptionalFields<Fields, Schema.Struct<{
        readonly dirty: Schema.Boolean;
        readonly touched: Schema.Boolean;
    }>>>;
    readonly submitting: Schema.Boolean;
}>;

Examples

import { StateSchema } from "@typed/ui/Form"
import { Schema } from "effect"

const codec = Schema.Struct({ email: Schema.String })
const stateCodec = StateSchema(codec)

Other public imports

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

Source