Reference to array of objects in Sanity
Im having issues with references in Sanity. Im setting some color themes in the root of my Sanity schema:
defineField({
name: 'articletheme',
title: 'Article theme',
description: 'Create 4 themes for article blocks',
type: 'array',
validation: (Rule) => Rule.required(),
of: [{ type: 'articleThemeBlock' }],
}),
In one of the blocks I would like to reference the theme array to select which color theme that block should use.
Ive tried this, but it fails:
defineField({
name: 'theme',
title: 'Theme',
type: 'reference',
to: [
{
type: 'array',
of: [
{
type: 'articletheme',
},
],
},
],
}),
Any suggestions?
Comments
Post a Comment