Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

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,

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 Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.