Sanity Library Reference Docs
    Preparing search index...

    Interface ArrayOfObjectsInputProps<T, S>

    interface ArrayOfObjectsInputProps<
        T extends { _key: string } = { _key: string },
        S extends ArraySchemaType = ArraySchemaType,
    > {
        __unstable_computeDiff: ComputeDiff<ProvenanceDiffAnnotation>;
        arrayFunctions?: ComponentType<ArrayInputFunctionsProps<T, S>>;
        changed: boolean;
        compareValue?: T[];
        displayInlineChanges: boolean;
        elementProps: ComplexElementProps;
        focused?: boolean;
        focusPath: Path;
        hasUpstreamVersion: boolean;
        id: string;
        level: number;
        members: ArrayOfObjectsMember[];
        onChange: (patch: PatchEvent | FormPatch | FormPatch[]) => void;
        onInsert: (event: ArrayInputInsertEvent<T>) => void;
        onItemAppend: (item: T) => void;
        onItemClose: () => void;
        onItemCollapse: (itemKey: string) => void;
        onItemExpand: (itemKey: string) => void;
        onItemMove: (event: ArrayInputMoveItemEvent) => void;
        onItemOpen: (path: Path) => void;
        onItemPrepend: (item: T) => void;
        onItemRemove: (itemKey: string) => void;
        onPathFocus: (path: Path, payload?: OnPathFocusPayload) => void;
        onSelectFile?: (props: InputOnSelectFileFunctionProps) => void;
        onUpload?: (event: UploadEvent) => void;
        path: Path;
        presence: FormNodePresence[];
        readOnly?: boolean;
        renderAnnotation?: RenderAnnotationCallback;
        renderBlock?: RenderBlockCallback;
        renderDefault: (props: InputProps) => Element;
        renderField: RenderFieldCallback;
        renderInlineBlock?: RenderBlockCallback;
        renderInput: RenderInputCallback;
        renderItem: RenderArrayOfObjectsItemCallback;
        renderPreview: RenderPreviewCallback;
        resolveInitialValue: (
            type: SchemaType,
            params: Record<string, unknown>,
        ) => Promise<T>;
        resolveUploader: UploaderResolver<ObjectSchemaType>;
        schemaType: S;
        validation: FormNodeValidation[];
        value: T[];
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    __unstable_computeDiff: ComputeDiff<ProvenanceDiffAnnotation>

    A function that takes any value and produces a diff between that value and the value the node is being compared to.

    This can be used to compute a diff optimistically.

    This is marked as unstable because the API may need to evolve as we iterate on the advanced version control functionality. It will be stabilised when that project has matured.

    arrayFunctions?: ComponentType<ArrayInputFunctionsProps<T, S>>
    changed: boolean

    Whether the current value is different to the value the node is being compared to.

    compareValue?: T[]

    The value the node is currently being compared to. This is taken from the upstream version, if the document has an upstream version. Otherwise, it's taken from the document's current value.

    You can use the hasUpstreamVersion prop to determine whether the document has an upstream version.

    displayInlineChanges: boolean

    Whether the input should display inline changes. Inline changes express how a field's value differs from its upstream version. Unlike custom diff components, inline changes is a mode that allows the input component itself to display the change in situ.

    elementProps: ComplexElementProps
    focused?: boolean

    Whether the node is focused.

    focusPath: Path

    The focus path of the form node.

    hasUpstreamVersion: boolean

    Whether the document has an upstream version.

    id: string

    The unique identifier of the node.

    level: number

    The level of the node in the form hierarchy.

    onChange: (patch: PatchEvent | FormPatch | FormPatch[]) => void
    onInsert: (event: ArrayInputInsertEvent<T>) => void
    onItemAppend: (item: T) => void
    onItemClose: () => void
    onItemCollapse: (itemKey: string) => void

    for array inputs using expand/collapse semantics for items

    onItemExpand: (itemKey: string) => void
    onItemMove: (event: ArrayInputMoveItemEvent) => void
    onItemOpen: (path: Path) => void

    for array inputs using modal open/close semantics for items

    onItemPrepend: (item: T) => void
    onItemRemove: (itemKey: string) => void
    onPathFocus: (path: Path, payload?: OnPathFocusPayload) => void
    onSelectFile?: (props: InputOnSelectFileFunctionProps) => void
    onUpload?: (event: UploadEvent) => void
    path: Path

    The path of the node in the form hierarchy.

    presence: FormNodePresence[]
    readOnly?: boolean

    Whether the node is read-only.

    renderAnnotation?: RenderAnnotationCallback
    renderBlock?: RenderBlockCallback
    renderDefault: (props: InputProps) => Element
    renderField: RenderFieldCallback
    renderInlineBlock?: RenderBlockCallback
    renderInput: RenderInputCallback
    renderPreview: RenderPreviewCallback
    resolveInitialValue: (
        type: SchemaType,
        params: Record<string, unknown>,
    ) => Promise<T>
    schemaType: S

    The schema type of the node.

    validation: FormNodeValidation[]

    The validation markers of the node.

    value: T[]

    The value of the node.