For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create and Manage Flyout Menus in WebViewer

Overview

Flyout Menus in WebViewer provide a compact and versatile way to offer additional options or actions without overcrowding the interface. These hovering menus appear upon user interaction with UI elements such as buttons.

Flyout Menus can be customized and integrated seamlessly, enhancing the user experience by neatly organizing extra functionalities.

Creating Flyout Menus

To add a Flyout Menu to your application, create instances of the UI.Components.Flyout class. Each instance can be tailored with custom items, icons, and onClick behaviors, including support for submenu items for deeper navigation options.

After creation, use the UI.Flyouts.addFlyouts method to integrate your Flyout Menu into the UI.

Methods in the Flyout Class

setItems

setItems(items): Sets an array of item objects to the flyout. Each object in the array should follow the structure described for the options.items in the constructor. This operation replaces the existing items in the flyout.

Example Use Case

Below is an example of creating a flyout, adding items to it, and then programmatically removing an item:

UI Components inside Flyouts

In WebViewer version 11.3+, you can add other UI components to a flyout's item list. This is particularly useful for creating a flyout containing prebuilt items such as a Zoom menu or a Preset Button. There are some exceptions, as some components wouldn't make sense to add to a flyout, such as a Panel.

Below is an example of a flyout with other nested components:

Flyout Management

The UI.Flyouts namespace offers a suite of methods for comprehensive Flyout Menu management, allowing for addition, removal, activation, and positioning within the UI. Following are the available methods:

addFlyouts

Integrates your Flyout Menu into the UI.

removeFlyout

Removes the flyout with the specified dataElement from the UI.

setActiveFlyout

Displays the flyout with the specified dataElement. Set to null to hide the active flyout.

setFlyoutPosition

Sets the position of the active flyout.

getFlyout

Returns the flyout with the specified dataElement as an instance of UI.Components.Flyout.

getAllFlyouts

Returns an array of all the flyouts currently in the UI as instances of UI.Components.Flyout.

Flyout Menus are a dynamic component of WebViewer's Modular UI, offering a flexible solution to incorporate additional user actions and options neatly within the user interface.

Last updated

Was this helpful?