Unrestricted custom components
When you require a component that is not available in the UI Bakery components list, you can develop it by utilizing the Unrestricted custom component. With the Unrestricted custom component, you can embed any HTML and JavaScript code without any constraints directly into the UI Bakery page.
It is not contained within an iframe and can be used for displaying overlays, popups, and other similar elements.
Component anatomy
Unlike a Custom component, the Unrestricted custom component is rendered on the same level as the rest of UI Bakery components.
We advise you to exercise caution while using it since it may disrupt the UI Bakery page layout and styles and potentially access app data.
A typical Unrestricted custom component would have the following structure:
3rd party scripts - UI Bakery will put all of the script tags with the "src" attribute to the end of the head tag. All of the scripts with the same src attributes will be loaded only once. If you remove a script, make sure to reload the page.
custom styles
custom JavaScript logic
Passing data inside of the component
The API and settings for the Unrestricted custom component are the same as those of the Custom component.
To pass the data into your custom component use the "Data" setting. This can be done by passing a JavaScript object that contains the necessary data, such as:
Additionally, you can pass the data using JS API in your actions:
To access this data within the custom component, use the following code:
You can also subscribe to updates of the data using the following code:
Receiving data and triggering actions from the component
If your custom component produces events or needs to trigger an action, use the following code:
To set the value of the component, use the following code inside the custom component:
Once executed, the new value is available as {{ui.customComponent.value}}
;
To trigger an action, use the following code inside the custom component:
Then, subscribe your action to the On Event trigger of the custom component. Once the UB.triggerEvent('data')
is executed, the assigned action will be triggered.
The data supplied to the triggerEvent()
function is available as {{ui.customComponent.value}}
as well as {{params}}
variable in the assigned action.
Last updated