Note
Studio is the canonical component reference. Studio is built directly from the web components’ source code and is always up-to-date. For the full list of properties, attributes, and events for each component, browse the component in Studio. The patterns on this page apply to every component.
Studio is the canonical component reference. Studio is built directly from the web components’ source code and is always up-to-date. For the full list of properties, attributes, and events for each component, browse the component in Studio. The patterns on this page apply to every component.
Working with component props
UX Toolkit components are native HTML web components. You configure them using HTML attributes in the markup, just like any standard HTML element.- Attribute names use kebab-case in HTML (e.g.,
card-token,show-title). - In native webview integrations, you pass the same properties via
postMessage()ascomponentProps, but converted to lower camelCase (e.g.,cardToken,showTitle). See Working within Native Webviews. - Required vs. optional props vary by component. Refer to each component’s Properties/Attributes section in Studio.
Listening to component events
A custom UI component event is emitted whenever a noteworthy action or behavior occurs within that component. You can develop your application to listen for and respond to whatever events matter to your use cases. The pattern is the same as listening to any DOM event —addEventListener on the component element, with the event name and a callback that receives the event detail:
Linking behavior between UI components
You can link the behavior between two UI components by adding event listeners for specific events. Example 1: Selecting a card from a list updates the card detail view. In the example below, an event listener listens formqCardListActionHook and, when a card is selected, sets the selected card’s token on the mq-card component:
mqTransactionListHook. If the requested operation is to view a transaction, a <div> element is created to contain the transaction component. Your application can then display the transaction details in a modal, including the Report a problem button for disputable transactions:
React example using onEvent handlers
In a React application, you can attach event listeners using a ref and useEffect. Note that React’s synthetic event system does not bridge to web component custom events automatically — you must use the underlying DOM event listener.
Related
- Studio — canonical component reference (props, events, live preview)
- Customizing UX Toolkit — themes, card art, translations
- Working within Native Webviews — embedding components in mobile webviews