Unrestricted custom components
When you require a component not available in our Components list, you can develop it by utilizing the unrestricted custom component. With it, you can embed any HTML or JavaScript code without any constraints directly into any UI Bakery page.
Unlike custom components, unrestricted custom components are NOT contained within an iframe and can be used for displaying overlays, popups, and other similar elements.
Component anatomy
In contrast to custom components, unrestricted custom components are rendered on the same level as the rest of UI Bakery components.
We advise you to exercise caution while using this type of component since it may disrupt the UI Bakery page layout and styles and potentially access app data.
Here is an example of an unrestricted custom component:
UI Bakery will put all script tags with the src attribute to the end of the head tag. All scripts with the same src attributes will be loaded only once. If you remove a script, make sure to reload the page.
Passing data to a component
The API and settings for the Unrestricted custom component are the same as those of the Custom component.
To pass data to your custom component you can use a component's Data property. You simply need to specify the JavaScript object that contains the necessary data, for example:
Additionally, you can pass data using JS API in your actions:
To access this data within the custom component, you can use:
You can also subscribe to data updates with the following code:
Receiving data and triggering actions from a component
If your custom component produces events or needs to trigger an action, you can use the following code:
Use this code inside a component to set its value. Once executed, the new value will be available as {{ui.customComponent.value}}
.
Use this code inside a component to trigger an action. You also need to 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 the{{ui.customComponent.value}}
variable as well as the {{params}}
variable in the assigned action.
Last updated