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="23.5.12") @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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Tooltip.TooltipPosition
Tooltip position in relation to the target element.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Tooltip
forComponent(Component component)
Creates a tooltip to the givenComponent
if one hasn't already been created.int
getFocusDelay()
The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.int
getHideDelay()
The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.int
getHoverDelay()
The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.Tooltip.TooltipPosition
getPosition()
Position of the tooltip with respect to its target.String
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
setText(String text)
String used as a tooltip content.Tooltip
withFocusDelay(int focusDelay)
The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.Tooltip
withHideDelay(int hideDelay)
The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.Tooltip
withHoverDelay(int hoverDelay)
The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.Tooltip
withManual(boolean manual)
When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.Tooltip
withPosition(Tooltip.TooltipPosition position)
Position of the tooltip with respect to its target.Tooltip
withText(String text)
String used as a tooltip content.
-
-
-
Method Detail
-
forComponent
public static Tooltip forComponent(Component component)
Creates a tooltip to the givenComponent
if one hasn't already been created.- Parameters:
component
- the component to attach the tooltip to- Returns:
- the tooltip handle
-
setText
public void setText(String text)
String used as a tooltip content.- Parameters:
text
- the text to set
-
getText
public String getText()
String used as a tooltip content.- Returns:
- the text
-
withText
public Tooltip withText(String text)
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
public Tooltip withFocusDelay(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
-
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
public Tooltip withHideDelay(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
-
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
public Tooltip withHoverDelay(int hoverDelay)
The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.- Parameters:
hoverDelay
- the delay in milliseconds
-
setPosition
public void setPosition(Tooltip.TooltipPosition position)
Position of the tooltip with respect to its target.- Parameters:
position
- the position to set
-
getPosition
public Tooltip.TooltipPosition getPosition()
Position of the tooltip with respect to its target.- Returns:
- the position
-
withPosition
public Tooltip withPosition(Tooltip.TooltipPosition position)
Position of the tooltip with respect to its target.- Parameters:
position
- the position to set
-
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
public Tooltip withManual(boolean manual)
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
-
-