Sanity Library Reference Docs
    Preparing search index...

    Interface ObjectItemProps<Item>

    Props for the ObjectItem component.

    interface ObjectItemProps<Item extends ObjectItem = ObjectItem> {
        __unstable_computeDiff: ComputeDiff<ProvenanceDiffAnnotation>;
        changed: boolean;
        children: ReactNode;
        collapsed: boolean;
        collapsible: boolean;
        compareValue?: unknown;
        description: string;
        focused?: boolean;
        hasUpstreamVersion: boolean;
        index: number;
        inputId: string;
        inputProps: Omit<
            ObjectInputProps<Record<string, any>, ObjectSchemaType>,
            "renderDefault",
        >;
        level: number;
        onBlur: (event: FocusEvent) => void;
        onClose: () => void;
        onCollapse: () => void;
        onCopy: (event: Omit<ArrayInputCopyEvent<Item>, "referenceItem">) => void;
        onExpand: () => void;
        onFocus: (event: FocusEvent) => void;
        onInsert: (
            event: Omit<ArrayInputInsertEvent<Item>, "referenceItem">,
        ) => void;
        onOpen: () => void;
        onRemove: () => void;
        open: boolean;
        parentSchemaType: ArraySchemaType;
        path: Path;
        presence: FormNodePresence[];
        readOnly?: boolean;
        renderDefault: (props: ItemProps) => Element;
        schemaType: ObjectSchemaType;
        title: string;
        validation: FormNodeValidation[];
        value: Item;
    }

    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.

    changed: boolean

    Whether the item has changes in a draft.

    children: ReactNode

    The children of the item.

    collapsed: boolean

    Whether the item is collapsed.

    collapsible: boolean

    Whether the item is collapsible.

    compareValue?: unknown

    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.

    description: string

    The description of the item.

    focused?: boolean

    Whether the item is focused.

    hasUpstreamVersion: boolean

    Whether the document has an upstream version.

    index: number

    The index of the item.

    inputId: string

    The ID of the input element.

    inputProps: Omit<
        ObjectInputProps<Record<string, any>, ObjectSchemaType>,
        "renderDefault",
    >
    level: number

    The level of the item.

    onBlur: (event: FocusEvent) => void

    The function to call when the item loses focus.

    onClose: () => void

    Callback for when the item is closed.

    onCollapse: () => void

    Callback for when the item is collapsed.

    onCopy: (event: Omit<ArrayInputCopyEvent<Item>, "referenceItem">) => void
    onExpand: () => void

    Callback for when the item is expanded.

    onFocus: (event: FocusEvent) => void

    The function to call when the item receives focus.

    onInsert: (event: Omit<ArrayInputInsertEvent<Item>, "referenceItem">) => void
    onOpen: () => void

    Callback for when the item is opened.

    onRemove: () => void

    The function to call when the item is removed.

    open: boolean

    Whether the item is open.

    parentSchemaType: ArraySchemaType

    The schema type of the parent array.

    path: Path

    The path of the item.

    presence: FormNodePresence[]
    readOnly?: boolean

    Whether the item is read-only.

    renderDefault: (props: ItemProps) => Element

    The function to call to render the default item. See ItemProps

    schemaType: ObjectSchemaType

    The schema type of the object.

    title: string

    The title of the item.

    validation: FormNodeValidation[]

    The validation markers for the item.

    value: Item

    The value of the item.