Customizing the comment thread slot with a callback function follows this pattern:
NutrientViewer.load({
// ... Your configuration.
ui: {
commentThread: (instance, id) => {
return {
render: (params) => {
const div = document.createElement("div");
// Return a DOM Node.
return div;
},
};
},
},
});
A callback function that returns a slot configuration. This provides a standard way to customize various slots.
The SDK internally calls this function once as it prepares to render the associated component.
You can think of it as an initialization phase for the slot. It receives two parameters:
instanceandid.instanceis the instance of Nutrient Web SDK, and you may make full use of the SDK APIs available on it.idis a unique identifier for the specific component being rendered into the slot. A component, such as comment thread, can have multiple instances, and the id helps to differentiate between them.