How to remove the "Create New Document" action from a specific part of the document list structure.
You can control the "Create New Document" button (the + icon) on a per-pane basis in your Structure Builder configuration using initialValueTemplates([]). This is perfect for your use case where you want to disable document creation in certain filtered list views while keeping it available elsewhere.
Here's how to implement it in your nested structure:
// structure/index.ts
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S) =>
S.list()
.id('root')
.title('Content')
.items([
// Your nested structure
S.listItem()
.title('Programs')
.child(
S.list()
.title('By Department')
.items([
S.listItem()
.title('Departments')
.child(
S.documentList()
.title('Departments')
.schemaType('department')
.filter('_type == "department"')
// Remove the + button from this list
.initialValueTemplates([])
),
S.listItem()
.title('Programs')
.child(
S.documentList()
.title('Programs')
.schemaType('program')
.filter('_type == "program"')
// Remove the + button from this list too
.initialValueTemplates([])
),
])
),
// Keep creation enabled in these main lists
S.documentTypeListItem('department').title('All Departments'),
S.documentTypeListItem('program').title('All Programs'),
])The .initialValueTemplates([]) method removes all creation options from that specific document list pane. By passing an empty array, you're telling Studio "don't show any document creation templates for this list."
This approach gives you granular control - the main "Create" button in the global Studio menu will still work, and your "All Departments" and "All Programs" lists will still have the + icon, but your filtered nested views won't.
If you later decide you want some templates but not all, you can be more selective by filtering specific templates instead of passing an empty array. The Initial Value Templates documentation and this Structure Builder guide have more details on advanced customization options.
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.