Made in Builder

Made in Builder

×

Developers

Product

Use Cases

Pricing

Developers

Resources

Company

Get StartedLogin

Product

Features

Integrations

Talk to an Expert

Pricing

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

Triggering Custom Actions in Builder with React

Sometimes you want buttons in your Builder content to trigger code in your React app. Follow along below to learn how you can do this.

Passing down the function

Using the context attribute, we can pass down any key/value pair we like to be used in our Builder content

Triggering the function in Builder

Let's assign our function to run on click of a button. Using the data tab, create a new "click" event. In the event handler, there is a context variable that holds the function you passed. Simply call context.myFunction() and you are done!

You can then save this as a template or symbol for easy reuse


Need Expert help?

Submit a project to our partners, BuildQuick, and be matched with a Builder expert.

Submit a project

Was this article helpful?