> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Structure Tool API

How to use the Structure Tool API to configure your structure tool(s).

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 your studio's Structure tool(s) with the Structure Tool API.

## Properties

#### Properties

**name**

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.

**title**

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

**icon**

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

**structure**

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().

**defaultDocumentNode**

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.

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

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

To customize your `structure` tool, pass an object in with the settings you want to customize. For instance, if you want a custom structure tool called “cars” that shows in the toolbar as “Cars” and has an icon from `react-icons` and tweaks both the `structure` and `defaultDocumentNode`:

```typescript
// 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')
        ])
    })
  ]
})
```



## Related changelog entries

Entries are listed newest first; each link points to the full entry as markdown. Follow one when you need to know what changed, when, or why — for example, to summarize recent updates, explain behavior that differs from older documentation, or check whether a fix has shipped.

- [Sanity Studio v3.24.1: Renamed API, Theming improvements ++](https://www.sanity.io/docs/changelog/5784e03f-504d-4f74-a6be-443ad1fd96b6.md) — January 11, 2024