1. Domino UI
  2. Components
  3. Popover
Top Tooltip Popover Docs

Popover

Base popover

The base class for creating popovers in the Domino UI framework. Popovers are small overlays that can be displayed next to an HTML element and often contain additional information or actions. This class provides the core functionality for creating and managing popovers.

Usage Example:

 
 // Create a new popover attached to an HTML element
 Element targetElement = document.getElementById("popover-target");
 BasePopover< MyPopover>  popover = new MyPopover(targetElement);

 // Customize the popover
 popover.withHeader(header ->  header.setTextContent("Popover Header"));
 popover.withBody(body ->  body.setTextContent("Popover Content"));

 // Show the popover
 popover.expand();
 

T

The type of the popover class that extends BasePopover .

See also :

Popover

The `Popover` class represents a pop-up dialog or tooltip that can be associated with an HTML element. It provides options to control its behavior, such as opening on click, closing on escape, and positioning.

Usage Example:

 
 HTMLElement targetElement = document.getElementById("targetElement");
 Popover popover = Popover.create(targetElement)
         .setOpenOnClick(true)    // Open the popover on click
         .setCloseOnEscape(true)  // Close the popover when pressing the "Escape" key
         .setModal(false);        // Make the popover non-modal
 

Tooltip

Represents a Tooltip which is a brief, informative message that appears when a user interacts with an element in a graphical user interface (GUI). Tooltips are usually initiated in one of two ways: through a mouse-hover gesture or through a keyboard-hover gesture.

Usage example:

 
 Tooltip.create(element, "This is a tooltip");
 

Examples

Tooltips Hover over a component to show a tooltip

Popover Click to show a custom popup over the component.

API Docs: BasePopover

Constructors

public void BasePopover()
Constructs a new BasePopover associated with the provided target element. BasePopover is the base class for creating popovers in the Domino UI framework.

Public methods

public int getOpenDelay()


Returns:

delay in milliseconds before showing the popover.

public T setOpenDelay(int openDelay)

openDelay

milliseconds to wait before showing the popover.



Returns:

same component instance

public T expand()
Expands the popover, displaying it on the screen.

Returns:

The current instance of the popover.

public T open()
Opens the popover, making it visible on the screen.

Returns:

The instance of the popover after opening.

public T close()
Closes the popover, hiding it from view.

Returns:

The instance of the popover after closing.

public boolean isModal()
Check super implementation documentation. Returns whether the popover is modal. Popovers are not modal by default.

Returns:

false since popovers are not modal by default.

public boolean isAutoClose()
Check super implementation documentation. Returns whether the popover should automatically close. Popovers are set to close automatically by default.

Returns:

true since popovers are set to close automatically by default.

public void discard()
Discards the popover by closing it. This method is equivalent to calling the close method. It is provided for convenience to explicitly indicate the intention to discard the popover.
public T setPosition(DropDirection position)
Sets the position of the popover relative to its target element.

position

The desired position of the popover.



Returns:

The current instance of the popover.

public T setCloseOthers(boolean closeOthers)
Specifies whether the popover should automatically close when other popovers are opened.

closeOthers

true to close other popovers, false to keep them open.



Returns:

The current instance of the popover.

public DivElement getArrowElement()
Gets the element representing the arrow of the popover.

Returns:

The arrow element of the popover.

public T withArrow(ChildHandler<T, DivElement> handler)
Sets the content of the popover's arrow element.

handler

A function to customize the arrow element.



Returns:

The current instance of the popover.

public DivElement getHeaderElement()
Gets the element representing the header of the popover.

Returns:

The header element of the popover.

public T withHeader(ChildHandler<T, DivElement> handler)
Sets the content of the popover's header element.

handler

A function to customize the header element.



Returns:

The current instance of the popover.

public DivElement getBody()
Gets the body element of the popover.

Returns:

The body element of the popover.

public T withBody(ChildHandler<T, DivElement> handler)
Sets the content of the popover's body element.

handler

A function to customize the body element.



Returns:

The current instance of the popover.

public HTMLElement getAppendTarget()
Gets the HTML element to which the popover's content should be appended.

Returns:

The HTML element to which the popover's content should be appended.

public T closeOnScroll(boolean closeOnScroll)
Sets whether the popover should be closed automatically when the user scrolls the page.

closeOnScroll

true to enable automatic closing on page scroll, false otherwise.



Returns:

The updated instance of the popover.

public T setOpenCondition(Supplier<Boolean> openCondition)
Sets a condition supplier that determines whether the popover should be opened. The popover will only open if the condition provided by the supplier evaluates to true .

openCondition

The supplier that provides the open condition.



Returns:

The updated instance of the popover.

public boolean isCloseOnBlur()
Checks if the popover should be closed when the user clicks outside of it (loses focus).

Returns:

true if the popover should be closed on blur, false otherwise.

public T setCloseOnBlur(boolean closeOnBlur)
Specifies whether the popover should automatically close when the user clicks outside of it.

closeOnBlur

true to close on blur, false to keep it open.



Returns:

The current instance of the popover.

public HTMLDivElement element()
Gets the DOM element representing the popover.

Returns:

The DOM element of the popover.

public boolean isCloseOnScroll()
Checks if the popover should automatically close when the user scrolls the page.

Returns:

true if the popover should close on page scroll, false otherwise.

public boolean isFollowerOpen()
Checks if the follower (popover) is currently open.

Returns:

true if the follower is open, false otherwise.

public void positionFollower()
Positions the follower (popover) relative to its target element.

API Docs: Popover

Constructors

public void Popover(HTMLElement target)
Creates a new `Popover` instance for the specified HTML element target.

target

The HTML element to associate the popover with.

public void Popover()
Creates a new `Popover` instance for the specified HTML element target.

Static methods

public static Popover create(HTMLElement target)
Creates a new `Popover` instance for the specified HTML element target.

target

The HTML element to associate the popover with.



Returns:

A new `Popover` instance.

public static Popover create(IsElement<? extends HTMLElement> target)
Creates a new `Popover` instance for the specified IsElement target.

target

The IsElement target to associate the popover with.



Returns:

A new `Popover` instance.

Public methods

public Popover detach()
Detaches the `Popover` from its associated target element and removes event listeners.

Returns:

The detached `Popover` instance.

public Popover closeOnEscape(boolean closeOnEscape)
Sets whether the `Popover` should close when the "Escape" key is pressed.

closeOnEscape

true to close on "Escape" key press, false otherwise.



Returns:

The updated `Popover` instance.

public boolean isOpenOnClick()
Checks if the `Popover` opens on a click event.

Returns:

true if the `Popover` opens on click, false otherwise.

public Popover setOpenOnClick(boolean openOnClick)
Sets whether the `Popover` should open on a click event.

openOnClick

true to open on click, false otherwise.



Returns:

The updated `Popover` instance.

public Popover setModal(boolean modal)
Sets whether the `Popover` should be modal (blocks interactions with other elements) or non-modal.

modal

true for modal, false for non-modal.



Returns:

The updated `Popover` instance.

public boolean isModal()
Check super implementation documentation.

Determines whether this popover is displayed as a modal dialog. If the popover is modal, it will prevent interactions with elements behind it while open.

Returns:

true if the popover is modal, false otherwise.

API Docs: Tooltip

Constructors

public void Tooltip(Element target, Node content)
Constructor for creating a tooltip with the specified target element and content node.

target

The target element.

content

The content node of the tooltip.

public void Tooltip(Node content)
Constructor for creating a tooltip with the specified target element and content node.

content

The content node of the tooltip.

Static methods

public static Tooltip create(Element target, String text)
Creates a tooltip with the specified target element and text.

target

The target element.

text

The text of the tooltip.



Returns:

The created tooltip.

public static Tooltip create(IsElement<? extends Element> target, String text)
Creates a tooltip with the specified target element and text.

target

The target element.

text

The text of the tooltip.



Returns:

The created tooltip.

public static Tooltip create(Element target, Node content)
Creates a tooltip with the specified target element and content node.

target

The target element.

content

The content node of the tooltip.



Returns:

The created tooltip.

public static Tooltip create(IsElement<? extends Element> target, Node content)
Creates a tooltip with the specified target element and content node.

target

The target element.

content

The content node of the tooltip.



Returns:

The created tooltip.

Public methods

public void detach()
Detaches the tooltip from the DOM.

We are a group of passionate people who love what we do

Donate & Support Us