Package com.vaadin.flow.component.shared
Class Tooltip
java.lang.Object
com.vaadin.flow.component.shared.Tooltip
- All Implemented Interfaces:
Serializable
@NpmPackage(value="@vaadin/tooltip",
version="24.0.0")
@JsModule("@vaadin/tooltip/src/vaadin-tooltip.js")
public class Tooltip
extends Object
implements Serializable
A handle that can be used to configure and control tooltips.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Tooltip position in relation to the target element. -
Method Summary
Modifier and TypeMethodDescriptionstatic Tooltip
forComponent
(Component component) Creates a tooltip to the givenComponent
.int
The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.int
The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.int
The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.Position of the tooltip with respect to its target.getText()
String used as a tooltip content.boolean
isManual()
When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.boolean
isOpened()
When true, the tooltip is opened programmatically.void
setFocusDelay
(int focusDelay) The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.void
setHideDelay
(int hideDelay) The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.void
setHoverDelay
(int hoverDelay) The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.void
setManual
(boolean manual) When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.void
setOpened
(boolean opened) When true, the tooltip is opened programmatically.void
setPosition
(Tooltip.TooltipPosition position) Position of the tooltip with respect to its target.void
String used as a tooltip content.withFocusDelay
(int focusDelay) The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.withHideDelay
(int hideDelay) The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.withHoverDelay
(int hoverDelay) The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.withManual
(boolean manual) When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.withPosition
(Tooltip.TooltipPosition position) Position of the tooltip with respect to its target.String used as a tooltip content.
-
Method Details
-
forComponent
Creates a tooltip to the givenComponent
.- Parameters:
component
- the component to attach the tooltip to- Returns:
- the tooltip handle
-
setText
String used as a tooltip content.- Parameters:
text
- the text to set
-
getText
String used as a tooltip content.- Returns:
- the text
-
withText
String used as a tooltip content.- Parameters:
text
- the text to set
-
setFocusDelay
public void setFocusDelay(int focusDelay) The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.- Parameters:
focusDelay
- the delay in milliseconds
-
getFocusDelay
public int getFocusDelay()The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.- Returns:
- the delay in milliseconds
-
withFocusDelay
The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.- Parameters:
focusDelay
- the delay in milliseconds
-
setHideDelay
public void setHideDelay(int hideDelay) The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.- Parameters:
hideDelay
- the delay in milliseconds
-
getHideDelay
public int getHideDelay()The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.- Returns:
- the delay in milliseconds
-
withHideDelay
The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.- Parameters:
hideDelay
- the delay in milliseconds
-
setHoverDelay
public void setHoverDelay(int hoverDelay) The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.- Parameters:
hoverDelay
- the delay in milliseconds
-
getHoverDelay
public int getHoverDelay()The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.- Returns:
- the delay in milliseconds
-
withHoverDelay
The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.- Parameters:
hoverDelay
- the delay in milliseconds
-
getPosition
Position of the tooltip with respect to its target.- Returns:
- the position
-
setManual
public void setManual(boolean manual) When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.- Parameters:
manual
- true to enable manual mode
-
isManual
public boolean isManual()When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.- Returns:
- true if manual mode is enabled
-
withManual
When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.- Parameters:
manual
- true to enable manual mode
-
setOpened
public void setOpened(boolean opened) When true, the tooltip is opened programmatically. Only works if `manual` is set to `true`.- Parameters:
opened
- true to open the tooltip
-
isOpened
public boolean isOpened()When true, the tooltip is opened programmatically. Only works if `manual` is set to `true`.- Returns:
- true if the tooltip is opened
-