📆 Don't miss our Sanity Showcase virtual meetup on March 20th!
@public
variable

structureTool

The structureTool is a studio plugin which adds the “structure tool” – a tool within Sanity Studio in which content editors can drill down to specific documents to edit them. You can configure your Studio's structure tool(s).

Import

import {structureTool} from 'sanity/structure'

Parameters

options

Options for the structure tool. See StructureToolOptions

Examples

Example #1

Minimal example

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

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

Example #2

To customise your structure tool

// sanity.config.ts
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import { FaCar } from 'react-icons'

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')
       ])
   })
 ]
})
sanity@3.79.0