Joint session with Vercel: How to build intelligent storefronts (May 15th)

Set default value for string list options in Sanity schema

22 repliesLast updated: Nov 29, 2025

Hi. I am trying to add a string type with a list in options. Is there a way to avoid a blank option in the dropdown by default and also set a specific option as the default selected option?
AI Update

Yes, you can control both the blank option and set a default value for a string field with a list in options!

Avoiding the blank option

When you use a list option with layout: 'dropdown', Sanity shows a blank option by default. To avoid this, you have two options:

Setting a default selected option

Use the initialValue property on your field to set which option is selected by default:

{
  title: 'Genre',
  name: 'genre',
  type: 'string',
  options: {
    list: [
      {title: 'Sci-Fi', value: 'sci-fi'},
      {title: 'Western', value: 'western'}
    ],
    layout: 'dropdown' // or 'radio'
  },
  initialValue: 'sci-fi' // Sets Sci-Fi as the default
}

Complete example

Here's a field configuration that avoids the blank option and sets a default:

{
  title: 'Genre',
  name: 'genre',
  type: 'string',
  options: {
    list: [
      {title: 'Sci-Fi', value: 'sci-fi'},
      {title: 'Western', value: 'western'},
      {title: 'Drama', value: 'drama'}
    ],
    layout: 'radio' // No blank option with radio buttons
  },
  initialValue: 'sci-fi' // Sci-Fi selected by default
}

The initialValue works with both dropdown and radio layouts. When using radio buttons, the specified value will be pre-selected. With dropdowns, it will show that value instead of a blank option when creating new documents.

You can find more details in the string type documentation and the initial values guide.

Show original thread
22 replies

Was this answer helpful?

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.

Related contributions