Skip to content

Tooltip ​

A lightweight floating label that appears on hover, focus, or click. Automatically flips placement when near viewport edges and dismisses on Escape.

Placement ​

Full width

Trigger Modes ​

Use the trigger attribute to control when the tooltip appears. Multiple triggers can be combined with commas (e.g. "hover,focus"). When trigger includes focus, the tooltip is automatically wired as a programmatic description (aria-describedby) for the focused element, which benefits screen reader users. A tooltip with the click trigger also closes when a pointer press starts outside its trigger and bubble; hover/focus-only tooltips do not use outside-pointer dismissal.

For explanations that also need tap activation, use trigger="hover,focus,click". A touch press that focuses the trigger opens the tooltip once and keeps it open; a second tap closes it. Touch pointer entry and exit do not act as hover. Changing trigger after mounting updates its listeners and cancels pending show/hide delays without replacing the element.

Full width

Variants ​

Full width

Prefer variant="light" on dark backgrounds.

Sizes ​

Full width

Show and Hide Delay ​

An unset delay opens on a trigger-aware dwell: 300ms on hover (so sweeping a pointer across a toolbar fires only the tooltip you rested on), and immediate on focus or click (both are deliberate). An unset close-delay hides after a 100ms grace on pointer leave (absorbing jitter across the trigger edge), and immediately on focus out.

Set delay or close-delay explicitly to override; delay="0" forces an immediate open on every trigger.

Shared Hover Warm-Up ​

The nearest ancestor with data-tooltip-group or role="toolbar" scopes hover warm-up. After one tooltip opens by hover, its siblings open immediately while a tooltip is open and for 500ms after the last closes. The first hover after that window uses the normal 300ms dwell again. Ungrouped tooltips and separate groups remain independent; an explicit delay always wins. Focus and click remain immediate when delay is unset.

html
<div data-tooltip-group>
  <ore-tooltip content="Undo last change"><ore-button>Undo</ore-button></ore-tooltip>
  <ore-tooltip content="Redo last change"><ore-button>Redo</ore-button></ore-tooltip>
</div>
Full width

Rich Content via Slot ​

For complex tooltip content, use the content named slot. Keep tooltip text short: one sentence or a keyboard shortcut label. Do not add interactive elements (buttons, links) inside the tooltip bubble; tooltips are not focusable.

Full width

Disabled Tooltips ​

Set disabled to suppress the tooltip entirely.

html
<ore-tooltip content="This won't show" disabled>
  <ore-button>No tooltip</ore-button>
</ore-tooltip>

Controlled Open State ​

Set open to control visibility. When a click-enabled tooltip requests dismissal, update open from the open-change event. Use default-open only to initialize an uncontrolled tooltip.

html
<ore-tooltip id="save-tip" content="Save changes" trigger="click">
  <ore-button>Save</ore-button>
</ore-tooltip>

<script type="module">
  const tooltip = document.getElementById('save-tip');

  tooltip.open = true;
  tooltip.addEventListener('open-change', (e) => {
    tooltip.open = e.detail.open;
    console.log('tooltip open:', tooltip.open, e.detail.reason);
  });
</script>

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
contentstring''Tooltip text
placement'top' | 'bottom' | 'left' | 'right''top'Preferred placement (auto-flips near viewport edges)
triggerstring'hover,focus'Trigger mode(s), comma-separated
delaynumber300 hover / immediate focus·clickShow delay in ms: 300 on hover, immediate on focus/click when unset
close-delaynumber100 pointer-leave / immediate focus-outHide delay in ms: 100 on pointer leave, immediate on focus out when unset
openbooleanN/AControlled open state; when set, trigger events are ignored
default-openbooleanfalseInitial visibility when open is not provided
variant'dark' | 'light'N/AVisual style (dark appearance is the unset default)
size'sm' | 'md' | 'lg'N/ATooltip bubble size (medium appearance is the unset default)
disabledbooleanfalseDisable the tooltip entirely

Slots ​

SlotDescription
(default)The trigger element the tooltip is anchored to
contentRich tooltip content (overrides the content attribute)

Events ​

EventDetailDescription
open-change{ open: boolean, reason: string }Emitted whenever the tooltip opens or closes

CSS Custom Properties ​

PropertyDescriptionDefault
--tooltip-max-widthMax width of the bubble18rem

Accessibility ​

The tooltip component follows WAI-ARIA best practices. The tooltip bubble has role="tooltip", and the trigger element is automatically augmented with aria-describedby pointing to the tooltip when the focus trigger is active. Pressing Escape while a tooltip is visible dismisses it.

Avoid using tooltips to hold essential information: if the user must see it to act, put it in helper text or an alert instead. Use trigger="focus" (or "hover,focus") for form field hints so keyboard-only users see them.