Tooltip
Accessible contextual description for hoverable and focusable controls.
- Selector
- [uiTooltip]
- Package
- @ngnova/ui/tooltip
Import
import { UiTooltipDirective } from '@ngnova/ui/tooltip';Usage & variants
Live examples use the public [uiTooltip] API, paired with the exact snippet a product team would paste into an Angular app.
Icon action guidance
Accessible contextual description for hoverable and focusable controls.
Production guidance
Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.
When to use
Use for concise supplemental context on icon buttons, unfamiliar controls, or truncated labels.
Watch for
The preferred position flips to its opposite side near viewport edges and clamps along the cross axis.
Product recipes
Apply Tooltip in distinct, copyable product scenarios—not just an isolated component state.
Icon control description
The same text appears after hover or keyboard focus and Escape dismisses it.
1 2 3 4 5 6 7 8
<button
type="button"
aria-label="Refresh"
uiTooltip="Refresh dashboard data"
tooltipPosition="bottom"
>
<svg aria-hidden="true"><!-- refresh icon --></svg>
</button>Truncated value
Reveal a clipped value on hover and focus while leaving the visible table layout compact.
1 2 3 4 5 6 7 8
<span
class="block max-w-48 truncate"
uiTooltip="enterprise-release-2026.07.28"
tooltipPlacement="top"
tabindex="0"
>
enterprise-release-2026.07.28
</span>API Reference
Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.
Inputs
uiTooltip required string Plain-text contextual description shown in the tooltip.
tooltipPosition 'top' 'top' | 'right' | 'bottom' | 'left' Preferred position; the overlay flips when that side collides with the viewport.
tooltipShowDelay 500 number Delay in milliseconds before the tooltip appears.
tooltipHideDelay 100 number Delay in milliseconds before the tooltip disappears.
tooltipDisabled false boolean Prevents the tooltip from opening.
tooltipId generated string Stable tooltip ID used in the trigger aria-describedby relationship.
| Name | Type | Default | Description |
|---|---|---|---|
uiTooltip | string | required | Plain-text contextual description shown in the tooltip. |
tooltipPosition | 'top' | 'right' | 'bottom' | 'left' | 'top' | Preferred position; the overlay flips when that side collides with the viewport. |
tooltipShowDelay | number | 500 | Delay in milliseconds before the tooltip appears. |
tooltipHideDelay | number | 100 | Delay in milliseconds before the tooltip disappears. |
tooltipDisabled | boolean | false | Prevents the tooltip from opening. |
tooltipId | string | generated | Stable tooltip ID used in the trigger aria-describedby relationship. |
Accessibility
- The overlay uses role="tooltip" and is added to the trigger aria-describedby list without replacing existing descriptions.
- Tooltip content is plain text and non-interactive; it supplements rather than replaces the trigger accessible name.
- Empty and disabled tooltips do not create an overlay or ARIA relationship.
Keyboard behavior
- Focus opens the tooltip after tooltipShowDelay and focus leaving schedules dismissal.
- Escape dismisses an open tooltip immediately without moving focus.
Testing guidance
- Use UiTooltipHarness to focus the trigger, read tooltip text from the document overlay, and dismiss with Escape.
- Test delay configuration, aria-describedby preservation, collision fallback, disabled behavior, and destroy cleanup.