How to use documentTypeList without the create button in Sanity?

11 replies
Last updated: Nov 29, 2025
Hello everyone, it's User! I was wondering if there's a way to use a
documentTypeList
without having the create button action at the top of the pane. Unfortunately, using a static list doesn't work for us because it removes the search and ordering features that we need to keep in the pane. Your help would be greatly appreciated.
AI Update

Yes, absolutely! You can hide the create button on a documentTypeList while keeping the search and ordering features by using the .initialValueTemplates([]) method.

Based on your use case, here's how to modify your structure:

S.listItem()
  .title('Blog Posts by Category')
  .child(
    S.documentTypeList('blogCategory')
      .title('Blog Categories')
      .initialValueTemplates([])  // <-- This removes the create button
      .child((categoryId: string) =>
        S.documentList()
          .title('Blog Posts')
          .filter('_type == "blog" && references($categoryId)')
          .params({ categoryId })
      )
  )

The key is adding .initialValueTemplates([]) to your documentTypeList. By passing an empty array, you're telling Sanity not to show any document creation options for that specific list, which effectively hides the "+" button.

This approach is perfect because:

  • It only affects the specific documentTypeList where you add it
  • Search and ordering features remain fully functional
  • You don't need to create custom components
  • Other document lists in your structure keep their create buttons

If you want to learn more about how initial value templates work, check out the Initial Value Templates documentation. There's also a comprehensive Structure Builder API reference that covers all the available methods for the sanity/structure package.

Show original thread
11 replies

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?