Tooltip
[vigTooltip]
import { Tooltip } from '@vigdx/ui/tooltip';Basic
vigTooltip with the text to any focusable element or to a component wrapping one, such as vig-button . Icon-only buttons still need an ariaLabel : the tooltip only describes, it does not name.
Positions
vigTooltipPosition sets the preferred side: top (default), end , bottom or start ; start and end follow the text direction (the deprecated left and right are physical sides). Without room the tooltip flips to the opposite side.
Disabled and non-interactive hosts
vigTooltipDisabled turns the tooltip off without removing it. On a non-interactive element add tabindex="0" , so keyboard users can reach the tooltip too.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="tooltip"][data-part="panel"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="tooltip"]
| Part | Element | data-state |
|---|---|---|
panel | role="tooltip" bubble, rendered in the overlay container. | — |
| Attribute | Meaning |
|---|---|
data-tooltip-trigger | id of its bubble, which exists while the tooltip is shown. |
Accessibility
- Follows the WAI-ARIA APG tooltip pattern: the panel has
role="tooltip". The text is wired from the first render, before any hover or focus, so screen-reader users browsing the page get it too: it describes the trigger (aria-describedby), names a trigger that has no name of its own (aria-labelledby), and is left out when it only repeats the trigger's name. A name from a<label>, a button'svalue, an image'saltor aplaceholdercounts. The hidden copy sits in one container at the end of the page (or of the enclosing dialog), never inside or beside the trigger; on a kit form field it joins the field's hint and error, so it stays when they change. - Shows on hover and on keyboard focus, but not on focus that follows a click. Escape hides it without moving focus or the pointer, wherever focus is; that press only dismisses the tooltip, so it never also closes a surrounding dialog.
- The panel itself can be hovered, so moving the pointer onto it keeps it open (WCAG 1.4.13, content on hover or focus).
- Tooltips are not reachable on touch screens and are read as descriptions: never put essential information or interactive content in them.
API
Tooltip
[vigTooltip]Text tooltip on hover and keyboard focus, dismissable with Escape wherever focus is (WCAG 1.4.13): that press closes only the tooltip, not a surrounding dialog.
The text is also kept in a hidden element from the first render, so
assistive tech has it before any interaction (a browse-mode screen reader
never hovers): it describes the trigger (aria-describedby), names a
trigger that has no name of its own (aria-labelledby), and is left out
when it only repeats the trigger's name. On a kit form field the reference
joins the field's own descriptions, so a hint or error appearing later
keeps it; on other elements a rewritten attribute gets it back.
<vig-button vigTooltip="Satırı sil" vigTooltipPosition="start" … />The bubble renders in the overlay container as
[data-scope="tooltip"][data-part="panel"]. While the tooltip has text
and is not disabled, the trigger carries data-tooltip-trigger set to the
bubble's id (the bubble exists only while shown), which
TooltipHarness (@vigdx/ui/testing) follows.
panel
tooltip
data-tooltip-trigger
| Name | Type | Default | Description |
|---|---|---|---|
vigTooltip | string | '' | — |
vigTooltipDisabled | boolean | false | — |
vigTooltipPosition | TooltipPosition | 'top' | — |