👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

List Arrays - Is it Possible to Fill a List Array Within a Schema Asynchronously?

2 replies
Last updated: Mar 16, 2021
Is it possible to populate a list array within a schema asynchronously with another document type as options? I’m trying to make a series of dynamic grouped categories more accessible to apply to a document as filters. It’s not easy to search them with an array of references as the parent element (the name of the category group) doesn’t show up, and category groups contain many categories with vague names which are sometimes shared across groups e.g.
categoryGroups: ["size", "width"]
both with a category
medium
.
Mar 16, 2021, 3:02 PM
I asked Knut about this a few weeks ago and you’d need to use a custom input. This thread was recently suggested so maybe it’s something that will make its way into references some time soon.
Mar 16, 2021, 3:26 PM
Hmm thanks
user A
! It’s a tricky one at present. I’ve not much custom input experience, beyond messing with the unicorn example for lols. I guess the best way to handle my specific case would be to keep an array of references within the schema, then define a custom input component which handles their presentation differently e.g. as a series of category checkboxes grouped by title.
Mar 16, 2021, 3:31 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?