TextOverflow

A directive that shows a cursor-following tooltip overlay only when the element's text content is actually clipped (scrollWidth > clientWidth).

Example

Hover over the clipped text to see the full content:

This is a very long text that will be clipped with an ellipsis
Hover me to see the full email subject line that gets truncated in the message list
Short text

Usage

Installation

API

Directive Value

TypeDescription
noneNo value needed. Uses the element's own textContent.

Requirements

RequirementDescription
overflow: hiddenThe element must clip its overflow for scrollWidth > clientWidth to trigger.
white-space: nowrapText should not wrap, otherwise it won't overflow horizontally.
text-overflow: ellipsisRecommended for visual ellipsis indication.

Behavior

BehaviorDescription
Smart detectionOnly shows tooltip when text is actually clipped. If text fits, nothing happens on hover.
Cursor followingTooltip follows the cursor at offset (10px, 20px).
Touch devicesTooltip is hidden on touch devices (hover: none media query).
ReactiveText content is updated whenever the element content changes.