I have a headless rendering based on this template: Heading: Single-line Text Description: Single-Line Text Background: Droplist (source: is an enum folder)
I have a sample item:
The droplist works fine here, but when it comes to rendering this in the tsx component, I am unsure how.
Here is the interface definitions:
interface Fields {
Heading: Field<string>;
Description: Field<string>;
Background: any;
}
type MyProps = {
params: { [key: string]: string };
fields: Fields;
}
I brought set up the props for the background field to be any
, to try and see what it would come in as, and it looks like it is coming in as a Field type. I put in a console.log
to inspect it:
As can be seen, the value that is coming in is just the selected value that was select in 1, not the list of possible choices. I am unable to build a select/option mapping (which from my understanding is how it is done with sitecore-jss-nextjs).
I've been struggling to find examples of rendering a droplist in xm-cloud or headless (though I am very new to Sitecore, so could just be not knowing the right keywords to search), so hoping someone may be able to assist, even if it is just a link to some sample code I can peruse.