
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes! To select multiple items from a dropdown, you need to change your field from a single reference type to an array of references. Here's how to modify your schema:
{
name: "category",
title: "Category",
type: "array", // Changed from "reference" to "array"
of: [
{
type: "reference",
to: { type: "category" }
}
],
inputComponent: conditionalFields,
options: {
condition: (document, parent) => parent.articleType != "shortStories"
}
}The key changes are:
type to "array" - This makes the field hold multiple itemsof property - This defines what types can be in the array (in your case, references to category documents)This will give you a multi-select interface where you can add multiple category references. Users can click to add categories, reorder them via drag-and-drop, and remove them individually.
The array field type in Sanity is specifically designed for storing orderable collections of items, and it's the standard way to handle multiple selections. Each selected item automatically gets a unique _key property that Sanity uses to track items.
If you need to query these multiple references later in GROQ, you can use array operations like:
*[_type == "yourDocType"] {
title,
"categories": category[]->title
}The []-> syntax dereferences all items in the array, giving you the full category documents.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store