The kbq-title directive shows a tooltip with the full text when the element's content does not fit and is truncated with an ellipsis. The tooltip appears only on actual overflow — on hover or keyboard focus — and stays out of the way when the text is fully visible.
#kbqTitleContainer (measured container) and #kbqTitleText (text element) template references.#kbqTitleText elements: the tooltip is shown if any of them overflows.[kbq-title] attribute.To detect overflow correctly in nested markup, mark the measured container with #kbqTitleContainer and the text element with #kbqTitleText. The directive compares the container and text sizes and shows the tooltip when the text does not fit.
<div kbq-title>
<div #kbqTitleContainer>
<div #kbqTitleText>{{ value }}</div>
</div>
</div>
When the container holds several text elements (for example, a name and a value in a filter-bar pipe), mark each of them with #kbqTitleText. The tooltip appears if at least one element overflows.
The directive accounts for vertical overflow as well as horizontal. This is useful when the text is clamped to several lines (-webkit-line-clamp).
By default the truncated text of the element is used as the tooltip content. To provide custom content, pass a string or a template reference (TemplateRef) to the [kbq-title] attribute. This is handy when you need formatted text or extra information.
In two-line list options a single kbq-title directive can cover the whole option. Mark both lines (name and description) with #kbqTitleText and the shared container with #kbqTitleContainer. The tooltip appears when at least one of the lines overflows and shows the full text of the option.