Complete the previous guide on building an extension app with app views
Add Buttons and Handler
Let's now add a button to the hashtag hover card and a handler to link the context. Use ADK.buttons.add to add a new button to the hashtag zone. To pass the context payload from the controller to the view, there are two options: either using query parameters or using ADK to invoke an exposed controller method from a view.
src/index.js
import*as ADK from"@symphony-ui/adk";ADK.start({ id:"adk-example" }).then(() => {ADK.buttons.add("Click Me","hashtag", (payload) => {console.log(`You clicked on a hashtag button`, payload);// Perform actions });});
Option 1: Use query parameters to pass context
In this option, we serialize the contents of the context payload and pass it directly into the ADK.modules.open call as query parameters.