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

    Interface SchemaViewProps<T, SchemaRef, Mode>

    Props accepted by SchemaView.

    Mirrors SchemaComponentProps for the read-only / RSC path — no onChange, no validate, and the theme is supplied via the resolver prop because Server Components cannot read React context.

    interface SchemaViewProps<
        T = unknown,
        SchemaRef extends string | undefined = undefined,
        Mode extends SchemaIoSide = "output",
    > {
        schema: RejectUnrepresentableZod<T>;
        schemaRef?: SchemaRef;
        io?: Mode;
        value?: InferSchemaValue<T, SchemaRef, Mode>;
        fields?: InferFields<T, SchemaRef>;
        meta?: SchemaMeta;
        description?: string;
        resolver?: ComponentResolver;
        widgets?: WidgetMap;
        onDiagnostic?: (diagnostic: Diagnostic) => void;
        strict?: boolean;
        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.

    Subject to the same compile-time rejection of unrepresentable Zod 4 types as the schema prop on <SchemaComponent> — see RejectUnrepresentableZod.

    schemaRef?: SchemaRef

    For OpenAPI / JSON Schema documents: a $ref string like "#/components/schemas/User". Named schemaRef (not ref) to avoid the React / preact/compat reserved prop name. See SchemaComponentProps.schemaRef.

    io?: Mode

    Which side of every transform / pipe / codec to render. Mirrors <SchemaComponent io>. Defaults to "output" — the inferred shape consumers receive from the server. Switch to "input" to render the INPUT side (omits readOnly properties for JSON Schema inputs, picks the input half of a z.codec(...)). Has no effect for plain JSON Schema or OpenAPI inputs without codec/transform constructs.

    Current value to render. Typed against InferSchemaValue<T, SchemaRef, Mode> so the prop tracks the schema's inferred shape for the chosen io direction. Falls back to unknown for runtime schemas where the value type cannot be statically inferred.

    Per-field meta overrides — nested object mirroring schema shape. Typed against InferFields so a typed schema prop drives autocomplete on the override map, matching <SchemaComponent>.

    meta?: SchemaMeta

    Meta overrides applied to the root schema.

    description?: string

    Convenience: sets description on the root.

    Theme resolver. In a Server Component you pass this explicitly since SchemaProvider (React context) is unavailable. Falls back to the headless resolver if omitted.

    widgets?: WidgetMap

    Instance-scoped widgets.

    onDiagnostic?: (diagnostic: Diagnostic) => void

    Called with each diagnostic emitted during schema processing.

    strict?: boolean

    When true, any diagnostic becomes a thrown error.

    idPrefix?: string

    Prefix used for every input id/label htmlFor in this view subtree. Defaults to a per-instance value from useId(); pass a deterministic value when stable ids matter (e.g. snapshot tests).