Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Can you populate an array field list from a sibling field in Sanity.io?

3 replies
Last updated: Mar 4, 2024
Hey. Im trying to populate array field list from a sibling field. Is that doable?
There is more to it than this, but I tried to extract the essence.


fields: [
		{
			name: 'colors',
			title: 'colors',
			type: 'array',
			of: [{ type: 'string' }],
		},
		{
			name: 'group',
			title: 'group',
			type: 'array',
			of: [{ type: 'string' }],
			options: {
				layout: 'grid',
				list: [GET VALUES FROM colors FIELD]
			}
		}
	],

Mar 1, 2024, 9:56 AM
You can adapt this component to use the
useFormValue
hook to get the values from the sibling field.
Mar 1, 2024, 4:37 PM
user P
Mar 4, 2024, 7:17 AM
Supert. Tusen takk :)
Mar 4, 2024, 10:22 AM

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?