ComponentsOverlay

Tooltip

A short hint next to an element: on hover, on keyboard focus, or opened from code. Screen readers get the text too, so an icon-only button with a tooltip needs no aria-label.

Features12APIThemingAccessibility

Basic

Add txTooltip to any element. It shows on hover and on keyboard focus and describes the element for screen readers.

Icon buttons

An element without a name of its own is named by its tooltip: these buttons are announced as "Edit", "Duplicate", "Download as PDF" and "Delete" without an aria-label. Move through them with Tab — the tooltips follow without a delay.

Placements

tooltipPlacement takes a side and an optional -start / -end alignment. The arrow keeps pointing at the middle of the element, and the tooltip flips to the other side when there is no room.

Triggers

tooltipEvent: both (default) opens on hover and on keyboard focus, hover on the pointer only, focus on any focus — a good fit for hints on fields. A click hides a hover tooltip until the pointer leaves; Escape hides any tooltip.

Delays

tooltipShowDelay and tooltipHideDelay (both 0 by default) set the timing; tooltipLife closes the tooltip on its own. While one tooltip was just open, the next one shows without a delay. Change the defaults for the whole app with provideTxTooltip({ showDelay: 400 }).

Multiline

tooltipMultiline makes the tooltip wider with taller lines for a few lines of text; new lines come from \n in the text.

Template

Pass an <ng-template> for rich content. tooltipContext arrives as let-data; let-close="close" gives a function that hides the tooltip. Text is always shown as text, so a template is the way to add markup.

  • Olena Koval
  • Marek Nowak
  • Sara Lind

Interactive

tooltipInteractive lets the pointer move onto the tooltip without closing it, so its text can be selected and copied — try the full order id. By default the tooltip closes as soon as the pointer leaves the element.

Order
Status

Overflow

tooltipOverflowOnly shows the tooltip only when the text is cut off with an ellipsis — the short titles have none.

Disabled

tooltipDisabled turns a tooltip off. A disabled button cannot take focus, so to explain why it is disabled put the tooltip on a focusable wrapper.

Manual

tooltipEvent="manual" leaves opening to your code: #tip="txTooltip" gives show(), hide(), toggle() and isOpen(). Here the tooltip confirms a copy and closes after tooltipLife.

https://example.com/invite/7Q2M

Design tokens

tooltipDt changes the tokens of one tooltip (the element itself may have its own dt). For every tooltip, override tooltip in the preset.