Integrate Modular UI Panels in WebViewer
Modular panels serve as dynamic components within WebViewer, designed to enhance user interaction by displaying content either on the left or right side. This guide provides detailed instructions and examples for incorporating both prebuilt and custom panels into your UI, offering a seamless integration process.
Prebuilt Panels
The UI includes a comprehensive selection of preconfigured panels designed to address common functionality requirements, such as thumbnail manipulation and document outline navigation. Through the use of the provided APIs, you can seamlessly integrate these panels into your UI. Additionally, you have the flexibility to customize various aspects of their behavior, such as the side of the UI from which they open.
List of Prebuilt Panels
Outline
Signature
Bookmarks
File Attachment
Thumbnail
Layers
Text Editing
Change List
Style
Redaction
Search
Notes
Tabs
Signature List
Rubber Stamp
Portfolio
Integrating Prebuilt Panels
To incorporate a prebuilt panel, utilize the addPanel API, specifying necessary properties such as dataElement, location, label, and render. For prebuilt panels, render corresponds to a reserved identifier, while for custom panels, it involves a function returning the panel element.
Visual representation of the panels:

Bookmarks Panel

Thumbnails Panel
To open the panels, you can use the API openElements with the dataElement of the panel. You can also add a toggle button to your UI and use the selector of the panel as the toggleElement of the button.
UI.Components.ToggleElementButton UI.getModularHeader setItems for Modular Headers setItems for Grouped Items
Adding Custom Panels
If you want to customize your UI even more, the Modular UI framework lets you build panels exactly the way you want. This means you can create special components that fit perfectly with what your app needs. You still use the same properties when creating panels with the prebuilt options. However, instead of passing a panel element identifier directly to the render property, you pass a function that returns the panel element. This element can be a React component or a DOM element built with JavaScript, giving you the flexibility to tailor your UI components to your specific requirements.
You can also add a custom panel to your UI by importing it along with the other panels and elements using a JSON config file. In this case, the render property would need to refer to a function name which is included in a function map.
Tabbed Panels
To efficiently manage space and organize content, the framework supports tabbed panels, allowing multiple panels to be housed within a single container. The TabPanel component facilitates this, accepting properties like dataElement, location, and panelsList, which is an array detailing each panel within the tabs.
The Tabbed panel is built using the component TabPanel that receives an object with the following properties:
dataElement (string, required): A unique string that identifies the panel;
location (string, 'left' or 'right', required): The location to place the panel;
panelsList (Array): An array of objects that represent the panels for the tabs. Each object should have the following properties:
dataElement (string, optional): A unique string that identifies the inner panel.
icon (string, optional): Path to an image or base64 data. Can also be the filename of a .svg from the WebViewer icons folder found here: assets/icons/ (i.e.
icon-saveto useicon-save.svg).render (string | function, required): When adding the prebuilt panels, it corresponds to the reserved identifier for the panels. For the custom panels, it is a function that returns the panel element.
You can have either prebuilt or custom panels added to your Tab Panel.
Adding prebuilt panels to a tab panel
The following code snippet is adding only prebuilt panels to the tab panel.
UI.addPanel UI.Components.ToggleElementButton UI.getModularHeader UI.Components.ModularHeader.setItems
This is the result:

Adding custom panels to a tab panel
For custom panels within a TabPanel, the render property receives a function returning the panel element. This can be a React component or a DOM element built with JavaScript.
Another option for adding custom panels in the TabPanel is to first register the panel with the viewer using the addPanel API or importing it with a config file and then using the panel's dataElement in the panelsList property.
Working with Panels
addPanel
To incorporate panels into your UI, begin by registering them with the addPanel method. This step makes the panels ready for use within your interface. For detailed guidance on utilizing this method, including all available options, refer to the earlier sections of this documentation.
Example usage:
getPanels
This API fetches a comprehensive list of all the modular panels that can be utilized in the current UI. Once you have this list, you can select any specific panel and modify its properties using the APIs described below.
Example usage:
setPanels
If you want to modify the list of panels, you can make the changes in the list using JavaScript methods to modify arrays and then you should call the setPanels API with the modified list as a parameter to update the panels list.
Example usage:
delete
This API deletes a panel from the UI, rendering it inaccessible for future usage. The deleted panel will remain in the panels' list but it will not be rendered in the UI.
setLocation
This method allows you to change the location of a panel within the Modular UI. It receives a string indicating the new location where the panel should be positioned. The available values for the location property are right and left.
Example usage:
Changing items in a Tab Panel
To change the items in a Tab Panel, you can use the UI.getPanels() API to get the list of panels and then find the Tab Panel you want to modify. You can then use the panelsList property to modify the sub-panels in the Tab Panel.
Rendering a Panel in a Flyout
In WebViewer version 11.7+, the following panels can be rendered as items inside of flyouts:
rubberStampPanelsignatureListPanelstylePanel
The panel to render is determined by the render property of the flyout item just like the one used to create a prebuilt panel.
The example below shows the Rubber Stamp Panel being rendered inside of a flyout that is toggled by the Stamp Panel button.

Using APIs
To add a panel to a flyout, first create a new flyout component with an item that includes a render property with a value that corresponds to the type of panel to be added. Then, add the flyout to the UI using the addFlyouts function:
To open the flyout, add a toggle button to the UI that targets the flyout’s dataElement.
Using a Config
The following example shows how to add a style panel to a flyout using a Modular UI config:
For more information on how to add flyouts to the WebViewer UI, refer to the guide here.
Tool Buttons and Panel Flyouts
When you use a ToolButton (e.g., for signatures or rubber stamps) and the corresponding panel is configured as a flyout, clicking the tool button will open the flyout—not the standalone panel.
Example:
The tool button above will open the standalone panel by default if it exists. However, if a flyout containing the panel is present, the tool button will open the flyout instead. This prevents opening both the panel and the flyout at the same time.
Last updated
Was this helpful?