import { KbqTitleModule } from '@koobiq/components/title';

Shows a tooltip with the full text of the host element, but only when that text is truncated — i.e. it overflows horizontally, or vertically when clamped to several lines. The tooltip opens on hover and on keyboard focus, and hides on blur, mouse leave, or window resize. By default, the tooltip content is the trimmed `textContent` of the host. Provide explicit content with `[kbq-title]="stringOrTemplateRef"`. For nested markup, mark the measured container with the `#kbqTitleContainer` template reference and the text element(s) with `#kbqTitleText`; several `#kbqTitleText` elements are supported and the tooltip is shown when any of them overflows. Host components that provide `KBQ_TITLE_TEXT_REF` (e.g. `KbqOption`) supply the text and parent elements automatically, so the directive works without explicit template references.

Selector: [kbq-title]

Exported as: kbqTitle
Properties
Name Description
@Input('kbq-title')
titleContent: InputSignal>
Optional explicit tooltip content. Accepts a `TemplateRef` (rendered as rich tooltip content) or a string. When omitted (a bare `kbq-title` attribute resolves to an empty string), the directive falls back to the trimmed `textContent` of the host (`viewValue`), preserving the default behavior.
arrow: boolean Input (`kbqTooltipArrow`) — whether to render the tooltip's arrow/pointer. Defaults to `false`.
color: string Input (`kbqTooltipColor`) with the tooltip color theme; the getter returns the `kbq-`-prefixed CSS class.
content: string | TemplateRef Input (`kbqTooltip`) with the tooltip content — a string or a template. Updating it refreshes an open tooltip.
context: any Input (`kbqTooltipContext`) with the context object passed to a template tooltip; updating it refreshes the open tooltip.
customClass: string Input (`kbqTooltipClass`) with an extra CSS class applied to the tooltip; updating it refreshes the class map.
disabled: boolean Input (`kbqTooltipDisabled`) controlling whether the tooltip is disabled; setting it to `true` hides it.
enterDelay: number Input (`kbqEnterDelay`) — delay in milliseconds before the tooltip is shown. Defaults to `400`.
forDisabledComponent: InputSignal>> Input for controlling the disabled state of a component. The input expects a component containing `disabledSignal` property, which is a writable signal emitting boolean values.
hasOnlyText: boolean Whether the host element contains exactly one child node and that node is a text node.
header: string | TemplateRef Header text or template, rendered above the tooltip content. Only meaningful with `kbqTooltipModifier="extended"`. Replaces the removed `KbqExtendedTooltipTrigger.header`.
hideWithTimeout: boolean Changes hiding behavior. By default, tooltip is hidden on mouseleave from trigger. Setting hideWithTimeout to true will delay tooltip hiding and will not hide when the mouse moves from trigger to tooltip.
ignoreTooltipPointerEvents: InputSignal Determines whether pointer events should be ignored on tooltips. When set to `true`, tooltip elements will not receive pointer events, allowing interactions to pass through to underlying elements. Defaults to `true`.
isHorizontalOverflown: boolean Whether the text is clipped horizontally: the parent `offsetWidth` is smaller than the child `scrollWidth`.
isOpen: boolean Whether the pop-up overlay is currently open.
isOverflown: boolean Whether the host content is clipped and therefore needs a tooltip. Returns `true` if any measured text element overflows the parent — covering multiple `#kbqTitleText` elements, the sub-pixel special case, and both horizontal and vertical overflow.
isVerticalOverflown: boolean Whether the text is clipped vertically: the parent `offsetHeight` is smaller than the child `scrollHeight`.
leaveDelay: number Input (`kbqLeaveDelay`) — delay in milliseconds before the tooltip is hidden. Defaults to `0`.
modifier: TooltipModifier | "default" | "warning" | "extended" Visual variant of the tooltip. Accepts `'default'` | `'warning'` | `'extended'`. Replaces the removed `KbqWarningTooltipTrigger` and `KbqExtendedTooltipTrigger` subclasses — to render a warning tooltip use `kbqTooltipModifier="warning"`, and `kbqTooltipModifier="extended"` for the extended variant (combine with `kbqTooltipHeader`).
offset: number Input (`kbqTooltipOffset`) — distance in pixels between the tooltip and its trigger; `null` uses the default.
placementChange: EventEmitter Output (`kbqPlacementChange`) that emits the new placement whenever the tooltip repositions.
relativeToPointer: boolean Positions the tooltip relative to the mouse cursor. Only available for top and bottom kbqPlacement. Does not work with kbqPlacementPriority.
tooltipPlacement: "top" | "topLeft" | "topRight" | "right" | "rightTop" | "rightBottom" | "left" | "leftTop" | "leftBottom" | "bottom" | "bottomLeft" | "bottomRight" Input (`kbqPlacement`) that sets the tooltip placement relative to its trigger; reflects the current `placement`.
tooltipPlacementPriority: string | string[] Input (`kbqPlacementPriority`) that sets the ordered fallback placements; reflects the current `placementPriority`.
tooltipVisible: boolean Input (`kbqVisible`) that programmatically shows or hides the tooltip; reflects the current `visible` state.
trigger: string
viewValue: string Trimmed `textContent` of the measured parent, used as the default tooltip content.
visibleChange: EventEmitter Output (`kbqVisibleChange`) that emits when the tooltip's visibility changes.
Methods
show
Shows the tooltip after `delay` ms. Suppresses showing on a focus trigger that did not originate from the keyboard, and applies cursor-relative positioning when `relativeToPointer` is enabled.
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.