ReferenceDisplay
media-tooltip
A tooltip component for displaying contextual labels on hover and focus
Import
Anatomy
Behavior
Displays a short label anchored to a trigger element. Opens after a configurable delay (default 600ms) on hover or immediately on focus. Closes when the pointer leaves or focus moves away, with an optional closeDelay.
The side and align props control the preferred placement relative to the trigger. When the preferred side overflows the positioning boundary, the tooltip uses the opposite side if it has more space. Positioning uses CSS Anchor Positioning where supported, with a JavaScript measurement fallback.
The <media-tooltip> element is the popup itself. Link it to a trigger using
the commandfor attribute on any button, pointing to the tooltip’s id. The element
discovers its trigger automatically and manages open/close state and positioning. Wrap
tooltip trigger/popup pairs in <media-tooltip-group> to coordinate
timing — the group’s delay, close-delay, and timeout attributes control shared
timing for all contained tooltips.
Tooltips inside a player container also observe its popup group. By default, a tooltip does not open—or closes if already open—while a menu or popover attached to the same trigger is open. Set sticky when the tooltip should remain visible with that trigger’s popup.
<media-tooltip-group> coordinates tooltip delay timing only; it does not replace the container’s popup group.
Styling
Use CSS custom properties for positioning offsets:
Style based on open state, rendered side, and transition phases. data-side reflects the rendered side and can differ from the preferred side prop after collision handling:
Accessibility
Tooltips are visual-only, supplementary labels. The popup renders with role="presentation" and is not referenced by the trigger with aria-describedby. Give the trigger its own accessible name instead of relying on tooltip content. Built-in media buttons already expose a state-aware aria-label, and their tooltips reuse that translated label. Tooltips still open on focus so keyboard users who can see the label receive the same visual hint.
Examples
Basic Usage
Grouping
Wrap tooltip trigger/popup pairs in <media-tooltip-group> to coordinate timing. The
group’s delay, close-delay, and timeout attributes control shared timing for all
contained tooltips.