@dxos/react-ui-form
    Preparing search index...

    Interface FormHandlerProps<T>

    Form properties.

    interface FormHandlerProps<T extends AnyProperties> {
        autoSave?: boolean;
        commitOn?: CommitOn;
        defaultValues?: Partial<T>;
        fieldOverrides?: Readonly<Record<string, FormFieldOverride>>;
        onCancel?: () => void;
        onSave?: (values: T, meta: FormUpdateMeta<T>) => MaybePromise<void>;
        onValidate?: (values: T) => undefined | ValidationError[];
        onValuesChanged?: (values: Partial<T>, meta: FormUpdateMeta<T>) => void;
        schema?: Codec<T, any, never, never>;
        values?: Partial<T>;
    }

    Type Parameters

    • T extends AnyProperties
    Index

    Properties

    autoSave?: boolean

    Auto-save the form when the values change.

    commitOn?: CommitOn

    When a typed value commits: change (the default) as each value parses; blur, only when the field blurs or Enter is pressed, so an auto-saving form writes one value per edit. Pickers, toggles and steppers commit at once.

    defaultValues?: Partial<T>

    Seeds an uncontrolled form once at mount when values is not provided; not reconciled thereafter.

    fieldOverrides?: Readonly<Record<string, FormFieldOverride>>

    Per-field overrides by json-path (style.hue); see FormFieldOverride.

    onCancel?: () => void

    Called when the form is canceled.

    onSave?: (values: T, meta: FormUpdateMeta<T>) => MaybePromise<void>

    Called when the form is submitted and passes validation.

    onValidate?: (values: T) => undefined | ValidationError[]

    Custom validation function that runs only after schema validation passes. Use this for complex validation logic that can't be expressed in the schema.

    Type declaration

      • (values: T): undefined | ValidationError[]
      • Parameters

        • values: T

        Returns undefined | ValidationError[]

        Array of validation errors, or undefined if validation passes

    onValuesChanged?: (values: Partial<T>, meta: FormUpdateMeta<T>) => void

    Callback for value changes. Note: This is called even when values are invalid. Sometimes the parent component may want to know about changes even if the form is in an invalid state.

    schema?: Codec<T, any, never, never>

    Effect schema (Type literal).

    values?: Partial<T>

    Source values. Fields the user is not editing reflect this value; in-progress edits (including intermediate invalid values) are held locally and never snap back until they are committed and the source catches up. Persist committed values from onValuesChanged/onSave. The form re-renders when a new value is passed, so to reflect external/remote mutations pass a reactive source (e.g. a useObject snapshot that changes on mutation) rather than a raw live object — a render-time read of an ECHO object does not itself subscribe to it.