Add Tabs to Document in Structure Builder
Yes! Sanity has a native feature called Field Groups that lets you organize document fields into tabs directly in your schema. This is the recommended way to add tabs to documents in Sanity Studio (works in both v2 and v3).
Here's how to implement it:
Basic Implementation
First, define your groups in the document schema, then assign fields to those groups:
export default defineType({
name: 'article',
type: 'document',
groups: [
{
name: 'content',
title: 'Content',
},
{
name: 'seo',
title: 'SEO',
},
{
name: 'settings',
title: 'Settings',
}
],
fields: [
defineField({
name: 'title',
type: 'string',
group: 'content', // Assigns this field to the content tab
}),
defineField({
name: 'slug',
type: 'slug',
group: 'seo', // Assigns this field to the SEO tab
}),
defineField({
name: 'publishedAt',
type: 'datetime',
group: 'settings', // Assigns this field to the settings tab
}),
]
})Key Benefits
- Native solution - Built into Sanity, no plugins needed
- Doesn't affect data structure - Groups are purely for UI organization
- Better editorial experience - Reduces clutter and helps editors focus on related fields
- Flexible - Fields without a group assignment remain accessible
Note on Structure Builder
Field Groups are defined at the schema level, not in the Structure Builder. The Structure Builder is for organizing how documents appear in the navigation/sidebar, while Field Groups organize the fields within a document's editing interface.
If you need more complex layouts, you can also check out Fieldsets for collapsible sections within a tab, or look into third-party plugins like sanity-plugin-tabs, though the native Field Groups feature is generally the best approach for most use cases.
Show original thread27 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.