Sanity Library Reference Docs
    Preparing search index...

    Interface BaseItemProps<T>

    Props for the base item component.

    interface BaseItemProps<T> {
        __unstable_computeDiff: ComputeDiff<ProvenanceDiffAnnotation>;
        changed: boolean;
        children: ReactNode;
        compareValue?: unknown;
        description: string;
        focused?: boolean;
        hasUpstreamVersion: boolean;
        index: number;
        inputId: string;
        level: number;
        onBlur: (event: FocusEvent) => void;
        onCopy: (event: Omit<ArrayInputCopyEvent<T>, "referenceItem">) => void;
        onFocus: (event: FocusEvent) => void;
        onInsert: (event: Omit<ArrayInputInsertEvent<T>, "referenceItem">) => void;
        onRemove: () => void;
        path: Path;
        presence: FormNodePresence[];
        readOnly?: boolean;
        renderDefault: (props: ItemProps) => Element;
        schemaType: SchemaType;
        title: string;
        validation: FormNodeValidation[];
        value: unknown;
    }

    Type Parameters

    • T

    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 current value is different to the value the node is being compared to.

    children: ReactNode

    The children of the item.

    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.

    level: number

    The level of the item.

    onBlur: (event: FocusEvent) => void

    The function to call when the item loses focus.

    onCopy: (event: Omit<ArrayInputCopyEvent<T>, "referenceItem">) => void
    onFocus: (event: FocusEvent) => void

    The function to call when the item receives focus.

    onInsert: (event: Omit<ArrayInputInsertEvent<T>, "referenceItem">) => void
    onRemove: () => void

    The function to call when the item is removed.

    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: SchemaType

    The schema type of the item.

    title: string

    The title of the item.

    validation: FormNodeValidation[]

    The validation markers for the item.

    value: unknown

    The value of the item.