Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.
Builder content link
Builder public api key
f30ea2dc70314252bac4eb26498700ee
What are you trying to accomplish
I would like to create an on-page filter that hides or shows the respective posts if the tags array on the post “item”
Description
I would like create a filter with click event bindings that hides or shows the posts on the page if the “post” contains a tag matching the value of the text clicked on.
Hi @john-hemlane, no problem! Here is how you can make this 100% in Builder:
Assuming you have already fetched your CMS data, create a grid of repeating posts using the “Repeat for each” feature in the data tab to create an article card for each post. Inside the article card, we can add a title, a “Tags” label, and a box where we can show the tags for that article. Above the grid, add a button that we can use to toggle the filter.
Add an element bindings to the title layer in the data tab to show the title. For the box layer inside of the article card, we can add another “Repeat for each” to repeat for each article tag. Then we can bind the Tag layer to the tag name so we can see each tag for that article (and verify our filter is working).
(add this to the Title layer)
(add this to the Box layer inside the article card)
(add this to the Tag layer inside the Box)
Add an on-click action to the button to toggle the state. For example, we could set the button to toggle state.rentalFilter.
Add a new ShowIf element binding to the Article Card layer and add the code below. Replace "#rental-process-101" with whichever tag you want to target.