packages/components/directives/eui-tooltip/eui-tooltip.directive.ts
Directive for displaying contextual information in a tooltip overlay on hover or focus. Provides semantic color variants and flexible positioning relative to the trigger element. Automatically handles show/hide behavior with configurable delays and keyboard dismissal. Built on Angular CDK Overlay for robust positioning and scroll handling.
Basic tooltip:
Example :<button euiTooltip="Save your changes">Save</button>Tooltip with position and variant:
Example :<span euiTooltip="Error occurred" position="below" euiTooltipDanger>!</span>Tooltip with delays:
Example :<a euiTooltip="Click for details" [showDelay]="500" [hideDelay]="200">Info</a>
| Selector | [euiTooltip] |
| exportAs | euiTooltip |
Methods |
|
Inputs |
HostListeners |
Accessors |
| contentAlignment |
Type : "left" | "right" | "center" | "justify"
|
Default value : 'center'
|
|
Sets the alignment of the content in the tooltip. |
| e2eAttr |
Type : string
|
Default value : 'eui-tooltip'
|
|
Sets the |
| euiTooltip |
Type : string
|
|
Tooltip content. |
| euiTooltipAccent |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has Accent state. |
| euiTooltipDanger |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has a Danger state. |
| euiTooltipInfo |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has Info state. |
| euiTooltipPrimary |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has a Primary state. |
| euiTooltipSecondary |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has a Secondary state. |
| euiTooltipSuccess |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has a Success state. |
| euiTooltipWarning |
Type : boolean
|
Default value : false
|
|
Whether the tooltip has a Warning state. |
| hideDelay |
Type : number
|
Default value : 0
|
|
Sets the delay for the tooltip to be hidden |
| isDisabled |
Type : boolean
|
Default value : false
|
|
Whether the tooltip is disabled. |
| position |
Type : "left" | "right" | "above" | "below" | "before" | "after" | string
|
Default value : 'above'
|
|
Sets the position of the tooltip relative to its trigger element. |
| showDelay |
Type : number
|
Default value : 0
|
|
Sets the delay for the tooltip to be visible. |
| focus |
Arguments : '$event'
|
| keydown.esc |
Arguments : '$any($event)'
|
| mouseenter |
Arguments : '$event'
|
| focused | ||||||
focused(event: FocusEvent)
|
||||||
Decorators :
@HostListener('focus', ['$event'])
|
||||||
|
Parameters :
Returns :
void
|
| Public hide |
hide()
|
|
Method that closes a tooltip.
Returns :
void
|
| mouseEntering | ||||||
mouseEntering(event: MouseEvent)
|
||||||
Decorators :
@HostListener('mouseenter', ['$event'])
|
||||||
|
Parameters :
Returns :
void
|
| Public show | ||||||||||
show(origin: EventTarget)
|
||||||||||
|
Method that shows a tooltip.
Parameters :
Returns :
void
|
| isOpen |
getisOpen()
|
|
Returns the current open state.
Returns :
boolean
|