@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
Type
Plugin_2<void | 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')
])
})
]
})