How to Create a Preview for a Custom Type

13 replies
Last updated: Oct 25, 2021
Hi there, I am trying to create a preview for a custom type called fullWidthText. It has a field named ‘text’. This ‘text’ field is reference to another custom type and then it to another:) I am able to see the text in the preview however if the author put text in columns(which is another custom field) the text is not shown in the preview. Could you please help for the solution.
Oct 21, 2021, 1:54 PM
in select section I call it like so👇
Oct 21, 2021, 1:55 PM
columnText: 'text.textColumns.text'
Oct 21, 2021, 1:55 PM
This is the field in my fullWidthText type
Oct 21, 2021, 2:02 PM
{ title: ‘Text’,
name: ‘text’,
type: ‘richTextPageEditor’
}
Oct 21, 2021, 2:03 PM
richTextPageEditor is an array of type block and other custom types
Oct 21, 2021, 2:04 PM
one of those custom types is
Oct 21, 2021, 2:05 PM
{ name: ‘textColumns’,
type: ‘textColumns’,
icon: MdViewColumn
},
Oct 21, 2021, 2:05 PM
textColumns has this field inside
Oct 21, 2021, 2:05 PM
{ title: ‘Text’,
name: ‘text’,
type: ‘textArea’
}
Oct 21, 2021, 2:05 PM
and textArea is a type of array of type block and a few custom fields
Oct 21, 2021, 2:06 PM
I want to reach that block part in textArea
Oct 21, 2021, 2:07 PM
Hey Nur! Unfortunately,
preview
does not work asynchronously so you won't be able to resolve those references to access that information.
Oct 21, 2021, 4:07 PM
Thanks for your reply
user M
Oct 25, 2021, 6:45 AM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?

Categorized in