Unlock seamless workflows and faster delivery with our latest releases – get the details

Can You Show/Hide an Array Item’s “+ Add Item” Option?

2 replies
Last updated: Aug 8, 2022
Hi, in Studio can one show/hide an array item’s “+ Add Item” option? I’d like to prevent shallow duplicates of an item. I know validation rules work after insertion, but maybe? there’s a way to control the list items when one clicks “+ Add Item”. If not, I assume Structure Builder can do it. Thanks!
Aug 8, 2022, 12:10 PM
Hey
user K
! Are these references to documents? If so, you can use the
filter
option (example here ).
However, if they're objects you will need to use validation to check for duplicates since they can't be dynamically filtered in the schema. You could also create a custom input component.
Aug 8, 2022, 4:24 PM
They’re objects, so maybe I’ll look into custom components. Thanks!
Aug 8, 2022, 8:56 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?