how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array?

3 replies
Last updated: Jan 28, 2026
Does anyone have a quick pointer/guidance on how to limit a reference to just one entry in Studio
reference
input side versus the default as-many-entries-as-you-fill-in-an-array?
AI Update

If you want to limit a reference field to just one entry instead of an array, simply use the reference type directly without wrapping it in an array. Here's the difference:

Single reference (what you want):

{
  name: 'director',
  title: 'Director',
  type: 'reference',
  to: [{type: 'person'}]
}

This gives you a single reference field where you can select one document.

Multiple references (array):

{
  name: 'directors',
  title: 'Directors',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [{type: 'person'}]
    }
  ]
}

This gives you an array where you can add as many references as you want.

So the key is: use type: 'reference' directly for a single entry, or wrap it in an array for multiple entries. The reference type itself is always for a single document - it's the array wrapper that allows multiple selections.

You can read more about reference fields in the Sanity reference type documentation.

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