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="25.0.0-beta5")
@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
Nested ClassesModifier and TypeClassDescriptionstatic enumTooltip position in relation to the target element. -
Method Summary
Modifier and TypeMethodDescriptionstatic TooltipforComponent(Component component) Creates a tooltip to the givenComponentif one hasn't already been created.intThe delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.intThe delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.intThe 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.booleanisManual()When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.booleanisOpened()When true, the tooltip is opened programmatically.voidsetFocusDelay(int focusDelay) The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.voidsetHideDelay(int hideDelay) The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.voidsetHoverDelay(int hoverDelay) The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.voidsetManual(boolean manual) When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.voidsetMarkdown(String markdown) Sets the tooltip content in Markdown format.voidsetOpened(boolean opened) When true, the tooltip is opened programmatically.voidsetPosition(Tooltip.TooltipPosition position) Position of the tooltip with respect to its target.voidSets the tooltip content as plain text.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.withMarkdown(String markdown) String used as a tooltip content in Markdown format.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 givenComponentif one hasn't already been created.- Parameters:
component- the component to attach the tooltip to- Returns:
- the tooltip handle
-
setText
Sets the tooltip content as plain text.- Parameters:
text- the text to set
-
setMarkdown
Sets the tooltip content in Markdown format.- Parameters:
markdown- the text to set in Markdown format
-
getText
String used as a tooltip content.- Returns:
- the text
-
withText
String used as a tooltip content.- Parameters:
text- the text to set
-
withMarkdown
String used as a tooltip content in Markdown format.- Parameters:
markdown- the text to set in Markdown format
-
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
-