Work in Progress: How to Create Repeatable Button Components, Fetching from a Database
Note: This page only applies to the Old Rendering Engine - for the New Rendering engine ask a Savvy Expert for help
Step 1: Create and Prepare your Button
Create a button where you want the list of buttons to appear.
Select the component and scroll to the bottom of the Options tab, open the Advanced dropdown.
Select the REPEATER KEY. This will be the key of the Computed field that is fetching the data and returning the array of objects. Here are some docs for reference:
Step 2: Transform the Data
Map it into an object with a 'key' key, and a 'text' key. Something like this:
Try giving it an HTML structure. For example:
Step 3: Style it
Add some classes so you can style it with custom selectors
Here's how to style components with custom selectors:
What if there's more data that I want to show when a user selects one of the options?
Another computed field can easily solve that. The code would look something like this:
This would return the full selected object!
Last updated