How to display multiple schemas but allow selecting only one?

16 replies
Last updated: Jan 28, 2026
Hey šŸ‘‹ Just a quick question, is it possible to display a list of schemas/content types but only allow the user to select one?
AI Update

Yes! It's definitely possible to display a list of schemas/content types and restrict selection to just one. This is exactly what the reference field type is designed for in Sanity Studio.

How it works

When you set up a reference field, you specify which document types can be referenced using the to property. Here's a basic example:

{
  name: 'myReference',
  type: 'reference',
  to: [
    {type: 'person'},
    {type: 'company'},
    {type: 'organization'}
  ]
}

This will show the user a list of all three document types (person, company, organization) to choose from, but they can only select one document from those types.

Key points

  • The reference field UI lets users search, browse, and select from the allowed document types
  • Users can only select one document at a time (unless you wrap it in an array)
  • You can filter which documents appear using the filter option if you need more control
  • By default, references are "strong" - meaning they enforce referential integrity

If you need multiple selections

If you actually want users to select multiple documents, you'd wrap the reference in an array:

{
  name: 'myReferences',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [{type: 'person'}, {type: 'company'}]
    }
  ]
}

But based on your question about selecting "only one," the standard reference field should be exactly what you need!

Show original thread
16 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?