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;
        description: string;
        focused?: boolean;
        index: number;
        inputId: string;
        key: string;
        level: number;
        onBlur: (event: FocusEvent) => void;
        onFocus: (event: FocusEvent) => void;
        onRemove: () => void;
        path: Path;
        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.

    description: string

    The description of the item.

    focused?: boolean

    Whether the item is focused.

    index: number

    The index of the item.

    inputId: string

    The ID of the input element.

    key: string

    The key of the item.

    level: number

    The level of the item.

    onBlur: (event: FocusEvent) => void

    The function to call when the item loses focus.

    onFocus: (event: FocusEvent) => void

    The function to call when the item receives focus.

    onRemove: () => void

    The function to call when the item is removed.

    path: Path

    The path of the item.

    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.