Sanity Library Reference Docs
    Preparing search index...

    Interface InsertMenuOptionsAlpha

    Options for the "insert menu" shown when adding items to an array with multiple member types.

    This is the canonical definition of these options. They are rendered by two separate implementations that integrate with one another: the Studio form input (packages/sanity/src/insert-menu in this repo, used by arrays in sanity/structure), and the app frontend via @sanity/visual-editing when previewing through sanity/presentation. @sanity/visual-editing-types (https://github.com/sanity-io/visual-editing/blob/main/packages/visual-editing-types/src/index.ts) re-uses this interface to derive the serialized form sent to the app frontend.

    This API may change

    interface InsertMenuOptions {
        filter?: boolean | "auto";
        groups?: { name: string; of?: string[]; title?: string }[];
        showIcons?: boolean;
        views?: (
            | { name: "list" }
            | { name: "grid"; previewImageUrl?: (schemaTypeName: string) => string }
        )[];
    }
    Index

    Properties

    filter?: boolean | "auto"

    'auto' filter: 'auto' automatically turns on filtering if there are more than 5 schema types added to the menu.

    groups?: { name: string; of?: string[]; title?: string }[]
    showIcons?: boolean

    defaultValue true

    views?: (
        | { name: "list" }
        | { name: "grid"; previewImageUrl?: (schemaTypeName: string) => string }
    )[]

    [{name: 'list'}]