I’m trying to get just one component working the way that I want to pave the way for everything else we’re looking to use Builder.io for.
So far I have a registered component Poster
that accepts a Title, Subtitle URL and Image.
My goal is instead of typing in these values you select a “Course” from a dropdown. Ideally this would be a map so that the associated course ID was passed into the prop.
For example the dropdown might contain:
<option value="1">Storytelling</option>
<option value="2">Cooking</option>
<option value="3">Music Production</option>
The list should be populated from data from our private GraphQL API:
{
"data": {
"courses": {
"nodes": [
{
"id": "1",
"title": "Storytelling"
},
{
"id": "2",
"title": "Cooking"
},
{
"id": "3",
"title": "Music Production"
}
}
]
}
}
I’ve seen docs on things like remote data bit this seems to relate more to if you want to repeat a component n times for a given API response. This isn’t what I’m looking for but rather adding a new dropdown in the Block Options (or somewhere similar) that allows me to select from a course utilising data from my own API.
Can anybody point me in the right direction? Is this possible with buider.io?