Multiple lists in Sanity desk structure

2 replies
Last updated: Apr 8, 2020
Is it possible to have multiple lists in the desk structure? E.g. a list with title content, and a list with title Settings below.
AI Update

Yes, absolutely! You can have multiple lists in your desk structure, including a content list and a settings list below it. This is a very common pattern in Sanity.

The Structure Builder API makes this straightforward. Here's how you'd set it up:

// structure/index.ts
import type {StructureResolver} from 'sanity/structure'

export const structure: StructureResolver = (S) =>
  S.list()
    .id('root')
    .title('Content')
    .items([
      // Content section
      S.listItem()
        .title('Content')
        .child(
          S.list()
            .title('Content')
            .items([
              S.documentTypeListItem('post').title('Posts'),
              S.documentTypeListItem('page').title('Pages'),
              S.documentTypeListItem('author').title('Authors'),
            ])
        ),
      
      // Divider (optional, for visual separation)
      S.divider(),
      
      // Settings section
      S.listItem()
        .title('Settings')
        .child(
          S.list()
            .title('Settings')
            .items([
              S.documentTypeListItem('siteSettings').title('Site Settings'),
              S.documentTypeListItem('navigation').title('Navigation'),
            ])
        ),
    ])

Then import this into your sanity.config.ts:

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

export default defineConfig({
  // ...other config
  plugins: [
    structureTool({structure}),
    // ...other plugins
  ],
})

You can also create a flatter structure without the nested lists if you prefer:

export const structure: StructureResolver = (S) =>
  S.list()
    .title('Content')
    .items([
      S.documentTypeListItem('post').title('Posts'),
      S.documentTypeListItem('page').title('Pages'),
      S.divider(),
      S.documentTypeListItem('siteSettings').title('Settings'),
    ])

The Structure Builder is incredibly flexible and supports infinitely-nestable categories, filtered lists, and custom groupings to create exactly the editorial experience your team needs!

Show original thread
2 replies
what do you mean multiple lists? you can customize with grouping listItems however you want, I have a settings list that itself is not an object nor document, just for grouping setting documents
If you mean adding multiple heading/titles in a single pane and list items under each one, then no, this is not currently possible with the current API. But as Cali said above, you can have multiple list items in a single pane that opens different lists in child panes. You can find more info about how to do that and how it looks like here: https://www.sanity.io/guides/getting-started-with-structure-builder

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?