Skip to content

Tooltip Specification

Tacho Zhelev edited this page Oct 8, 2018 · 14 revisions

Tooltip Specification

Contents

  1. Overview
  2. User Stories
  3. API
  4. Test Scenarios
  5. Limitations
  6. Design

The igxTooltipTarget and the igxTooltip directives provide us with a way to display a tooltip for a specific element.

Tooltip with a simple text

<button [igxTooltipTarget]="tooltipRef">Hover me</button>

<span #tooltipRef="tooltip" igxTooltip>Hello there, I am a tooltip!</span>

As a developer, I want to:

  • be able to display a tooltip for a specific element when hovered with the mouse or focused with the Tab key.
  • be able to hide the tooltip of a specific element when no longer hovering it with the mouse.
  • be able to manually show the a tooltip for a specific element without interacting with the mouse (for example hovering the element).
  • be able to manually hide the tooltip of a specific element without interacting with the mouse.
  • be able to specify the delay time of a tooltip before it gets shown.
  • be able to specify the delay time of a tooltip before it gets hidden.
  • be able to specify the position at which the tooltip should be displayed.
  • be able to specify if the tooltip should automatically open on hover of the element.
  • be able to specify if the tooltip should automatically close when no longer hovering the element.
  • be able to use a default template for the content of the tooltip with the ability to style it.
  • be able to provide a custom template for the content of the tooltip.
  • be able to enable/disable the tooltip from showing.

As an end user, I want to:

  • be able to display a tooltip for an element when hovering with the mouse or focusing with the Tab key.
  • be able to hide the tooltip of an element when no longer hovering it with the mouse.
  • be able to interact with the content of the tooltip.

IgxTooltipDirective Properties

Name Type Description
context any Specifies the context of the tooltip. (Used to store and access any tooltip related data.)

Since the IgxTooltip directive extends the IgxToggle directive and there is no specific functionality it adds apart from some styling classes and attributes in combination with the properties from above, you can refer to the IgxToggle README for additional details.

IgxTooltipTargetDirective Properties

Name Type Description
showDelay number Specifies the amount of milliseconds that should pass before showing the tooltip.
hideDelay number Specifies the amount of milliseconds that should pass before hiding the tooltip.
tooltipDisabled boolean Specifies if the tooltip should not show when hovering its target with the mouse. (defaults to false)
tooltipHidden boolean Indicates if the tooltip is currently hidden.
nativeElement any Reference to the native element of the directive.

IgxTooltipTargetDirective Methods

Name Type Arguments Description
showTooltip void N/A Shows the tooltip after the amount of ms specified by the showDelay property.
hideTooltip void N/A Hides the tooltip after the amount of ms specified by the hideDelay property.

IgxTooltipTargetDirective Events

Name Description Cancelable Event arguments
onTooltipShow Emitted when the tooltip starts showing. (This event is fired before the start of the countdown to showing the tooltip.) True ITooltipShowEventArgs
onTooltipHide Emitted when the tooltip starts hiding. (This event is fired before the start of the countdown to hiding the tooltip.) True ITooltipHideEventArgs

Automation

  • The values of the IgxTooltipTargetDirective inputs can be changed.
  • The tooltip is initially hidden.
  • The tooltip is opened when hovering its target and is hidden when unhovering its target.
  • The default position of the tooltip is bottom-center in relation to its target.
  • The tooltip is not opened when it is disabled and hovering its target.
  • The mouseenter and mouseleave interactions respect the showDelay and the hideDelay values.
  • The tooltip is opened when opening it through the API and is hidden when closing it through the API.
  • The opening and closing methods from the API respect the showDelay and the hideDelay values.
  • The tooltip closes and reopens if it was opened through API and then its target is hovered.
  • The tooltip closes and reopens if opening it through API multiple times.
  • The tooltip respects the passed overlay settings
  • The tooltip emits onTooltipShow and onTooltipHide events accordingly.
  • The tooltip emits onTooltipShow and onTooltipHide events with the correct event arguments.
  • The onTooltipShow and onTooltipHide events can be successfully cancelled.
  • The tooltip closes when pressing the 'Escape' key.

Manual

  • Test the behavior of the tooltip with various overlaySettings.

Currently in order to set a simple text tooltip to an element, rather than setting a single input property for example, the developer has to create an additional DOM element that contains the tooltip text and mark the DOM element as an IgxTooltip.

defaults: Artboard custom: Artboard

Clone this wiki locally