Sanity Library Reference Docs
    Preparing search index...

    Interface StructureToolOptions

    The params for the structureTool api. See structureTool

    interface StructureToolOptions {
        defaultDocumentNode?: DefaultDocumentNodeResolver;
        icon?: ComponentType;
        keepPanesOnCreate?: boolean;
        name?: string;
        source?: string;
        structure?: StructureResolver;
        title?: string;
    }
    Index

    Properties

    defaultDocumentNode?: DefaultDocumentNodeResolver

    A resolver function used to return the default document node used when editing documents. See DefaultDocumentNodeResolver

    icon?: ComponentType
    keepPanesOnCreate?: boolean

    Keeps the navigation panes in place when a document is created from a pane that sits deeper than the intent matcher looks.

    The matcher only answers for the two outermost panes, and a documentTypeList().child() drops its intent handler entirely, so a "create" action offered by a deeper pane is handed to structure-wide intent resolution instead. Finding no match there, the studio replaces the whole pane path with a lone document editor, and the editor loses their place in the tree.

    With this enabled, a create action offered by one of the open panes opens the new document as that pane's child, the way opening an existing document from a list does: the navigation panes stay visible and collapse when there is not enough room.

    Only create actions offered by a pane that is currently open are affected, matched on the template and its parameters. Anything the structure search has to find is untouched and still jumps to the matching location: deep links, intents from other tools, and create actions for a type no open pane offers. Note that a pane offering the requested action counts even when the action was triggered elsewhere, so the navbar's "create new document" opens in an open list pane for that type rather than navigating to another one.

    name?: string
    source?: string

    A workspace can have different "sources". These sources were meant to allow using multiple datasets within the same workspace, for instance. This is not supported yet, but the API is still here.

    structure?: StructureResolver

    A structure resolver function. See StructureResolver

    title?: string

    The title that will be displayed for the tool. Defaults to Structure