Component Renderers
The SDK allows advanced users to replace the render function of some components with their own custom solution.
This is achieved through the setCustomRenderer
method. It accepts a configuration object with the following parameters:
Key | Type | Description |
---|---|---|
section | String - required | The key of the section that needs to be replaced (see the list of overridable sections below). |
componentId | String - required | The ID of the experience component which the section belongs to |
render | Function | The custom render function. It accepts predefined parameters (see the list of overridable sections below) and should return HTML as a string. |
middleware | Function | The custom middleware function to modify predefined parameters (see the list of overridable sections below) |
shouldOverride | Function | A function that accepts the same parameters as render and must return a Boolean. If it returns true the custom render will be displayed. |
onDidRender | Function | A function that accepts the same parameters as render and will be called after the override function ran. |
className | String | Optional CSS classes for the custom renderer container. |
style | Object | Custom CSS styles that will be applied to the renderer container. |