Sanity Library Reference Docs
    Preparing search index...

    Interface DocumentDefinition

    Construct a type with the properties of T except for those in type K.

    interface DocumentDefinition {
        __experimental_formPreviewTitle?: boolean;
        __experimental_omnisearch_visibility?: boolean;
        __experimental_search?: { mapWith?: string; path: string; weight: number }[];
        components?: DocumentComponents;
        deprecated?: DeprecatedProperty;
        description?: string | Element;
        fields: FieldDefinition<
            | "string"
            | "number"
            | "boolean"
            | "object"
            | "text"
            | "crossDatasetReference"
            | "reference"
            | "image"
            | "document"
            | "url"
            | "email"
            | "date"
            | "block"
            | "array"
            | "datetime"
            | "file"
            | "geopoint"
            | "globalDocumentReference"
            | "slug"
            | "sanity.video",
            undefined,
        >[];
        fieldsets?: FieldsetDefinition[];
        groups?: FieldGroupDefinition[];
        hidden?: ConditionalProperty;
        icon?: ReactNode
        | ComponentType<{}>;
        initialValue?: InitialValueProperty<any, Record<string, unknown>>;
        liveEdit?: boolean;
        name: string;
        options?: DocumentOptions;
        orderings?: SortOrdering[];
        preview?: PreviewConfig;
        readOnly?: ConditionalProperty;
        renderMembers?: ObjectRenderMembersCallback;
        title?: string;
        type: "document";
        validation?: ValidationBuilder<DocumentRule, SanityDocument>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    __experimental_formPreviewTitle?: boolean

    Determines whether the large preview title is displayed in the document pane form

    __experimental_omnisearch_visibility?: boolean
    __experimental_search?: { mapWith?: string; path: string; weight: number }[]

    Unused. Use the new field-level search config.

    components?: DocumentComponents
    deprecated?: DeprecatedProperty
    description?: string | Element
    fields: FieldDefinition<
        | "string"
        | "number"
        | "boolean"
        | "object"
        | "text"
        | "crossDatasetReference"
        | "reference"
        | "image"
        | "document"
        | "url"
        | "email"
        | "date"
        | "block"
        | "array"
        | "datetime"
        | "file"
        | "geopoint"
        | "globalDocumentReference"
        | "slug"
        | "sanity.video",
        undefined,
    >[]

    Object must have at least one field. This is validated at Studio startup.

    fieldsets?: FieldsetDefinition[]
    icon?: ReactNode | ComponentType<{}>
    initialValue?: InitialValueProperty<any, Record<string, unknown>>
    liveEdit?: boolean
    name: string
    options?: DocumentOptions
    orderings?: SortOrdering[]
    preview?: PreviewConfig

    Callback that allows developers to customize the members of the object input. It can be used to add decoration members to the object input, instead of using empty fields. For example:

    import { Decoration } from './Decoration'

    renderMembers: (members) => {
    return [
    ...members,
    {
    key: 'decoration',
    kind: 'decoration',
    component: Decoration,
    },
    ]
    title?: string
    type: "document"