schema-components - v3.7.0
    Preparing search index...

    Interface SchemaComponentProps<T, SchemaRef, Mode>

    Props accepted by SchemaComponent.

    Mirrors react/SchemaComponent's SchemaComponentProps shape — the generic parameters carry the inferred schema shape through to value, onChange, and fields so a typed schema prop drives typed props on the rest of the component.

    interface SchemaComponentProps<
        T = unknown,
        SchemaRef extends string | undefined = undefined,
        Mode extends SchemaIoSide = "output",
    > {
        schema: RejectUnrepresentableZod<T>;
        schemaRef?: SchemaRef;
        io?: Mode;
        value?: InferSchemaValue<T, SchemaRef, Mode>;
        onChange?: (value: InferSchemaValue<T, SchemaRef, Mode>) => void;
        validate?: boolean;
        onValidationError?: (error: unknown) => void;
        onError?: (error: SchemaError) => void;
        onDiagnostic?: (diagnostic: Diagnostic) => void;
        strict?: boolean;
        fields?: InferFields<T, SchemaRef>;
        meta?: SchemaMeta;
        readOnly?: boolean;
        writeOnly?: boolean;
        description?: string;
        widgets?: SolidWidgetMap;
        idPrefix?: string;
    }

    Type Parameters

    • T = unknown
    • SchemaRef extends string | undefined = undefined
    • Mode extends SchemaIoSide = "output"
    Index

    Properties

    Zod schema, JSON Schema object, or OpenAPI document.

    schemaRef?: SchemaRef

    For OpenAPI: a ref string like "#/components/schemas/User".

    io?: Mode

    Which side of every transform / pipe / codec to render.

    Current value to render — typed against the schema's inferred shape.

    onChange?: (value: InferSchemaValue<T, SchemaRef, Mode>) => void

    Called when the value changes; receives the next value.

    validate?: boolean

    Run safeParse / safeEncode on change and route errors.

    onValidationError?: (error: unknown) => void

    Called with the validation error when validation fails.

    onError?: (error: SchemaError) => void

    Called when schema normalisation or rendering fails.

    onDiagnostic?: (diagnostic: Diagnostic) => void

    Called with each diagnostic emitted during schema processing.

    strict?: boolean

    When true, any diagnostic becomes a thrown error.

    Per-field meta overrides — nested object mirroring schema shape.

    meta?: SchemaMeta

    Meta overrides applied to the root schema.

    readOnly?: boolean

    Convenience: sets readOnly on all fields.

    writeOnly?: boolean

    Convenience: sets writeOnly on all fields.

    description?: string

    Convenience: sets description on the root.

    widgets?: SolidWidgetMap

    Instance-scoped widgets — override context and global widgets.

    idPrefix?: string

    Prefix used for every input id / label for in this component subtree. Defaults to a per-instance value from createUniqueId() so multiple <SchemaComponent> instances on the same page never collide. Override for deterministic ids in screenshot tests.