Default fieldsets to collapsed in Sanity desk view
Yes, you can absolutely default fieldsets to be collapsed! You just need to use the options property in your fieldset configuration with two key settings:
{
title: 'My Fieldset',
name: 'myFieldset',
options: {
collapsible: true, // Makes the fieldset collapsible
collapsed: true // Sets it to be collapsed by default
}
}The collapsible: true option makes the fieldset expandable/collapsible, and collapsed: true sets it to start in the collapsed state when you open a document.
You can also add a columns property if you want to arrange the fields in a grid layout when expanded:
options: {
collapsible: true,
collapsed: true,
columns: 2 // Arranges fields in 2 columns
}This is super useful for keeping your editing interface clean, especially for documents with lots of fields. You can collapse less frequently used sections (like SEO metadata or technical settings) by default, so editors see a cleaner interface when they first open a document.
One heads up: if you're using fieldsets with nested objects, the nested object might inherit the collapsible behavior from the parent fieldset. If you get unintentional double-collapse behavior, you can fix it by setting collapsible: false on the nested object itself.
More details in the fieldsets documentation and this specific answer about collapsing fieldsets.
Show original thread1 reply
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.