Studio

Structure Tool API

How to configure the Structure Tool in your studio with the structureTool plugin options.

The Structure Tool is a top-level view within Sanity Studio where editors can drill down to specific documents to edit them. You can configure one or more Structure Tools in your studio with the Structure Tool API.

Properties

structureTool() accepts an optional options object. All of its properties are optional:

  • The name you want this structure to have (among other places, this name is used in routing, if name is set to structure, it is shown on /structure). Usually lowercase or camelcase by convention. Defaults to structure.

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

  • React icon component for the tool, used in navigation bar. Defaults to MasterDetailIcon from @sanity/icons.

  • A structure resolver function. Receives two arguments:

    • S: an instance of the structure builder that can be used to build the lists/items/panes for the structure tool.
    • context: an object holding various context that may be used to customize the structure, for instance the current user.

    Defaults to (S) => S.defaults().

  • A resolver function used to return the default document node used when editing documents. Receives two arguments:

    • S: an instance of the structure builder that can be used to build the document node (S.document()).
    • context: an object holding various context that may be used to customize the document node.

Minimal example

The sanity/structure package exports a structureTool, which is a plugin that installs a structure tool. You can add it to your studio by passing it as part of the plugins array.

// sanity.config.ts
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'

export default defineConfig({
  // ...
  plugins: [
    structureTool() // use defaults
  ]
})

To customize the Structure Tool, pass an object with the settings you want to change. For example, the following configuration adds a custom Structure Tool named “cars” that shows in the toolbar as “Cars”, uses an icon from react-icons, and customizes both the structure and defaultDocumentNode:

// sanity.config.ts
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import { FaCar } from 'react-icons/fa'
import { Preview } from './Preview' // your custom preview component

export default defineConfig({
  // ...
  plugins: [
    structureTool({
      name: 'cars',
      title: 'Cars',
      icon: FaCar,
      structure: (S) => S.documentTypeList('car'),
      defaultDocumentNode: (S) =>
        S.document().views([
          S.view.form(),
          S.view.component(Preview).title('Preview')
        ])
    })
  ]
})

Was this page helpful?

Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme