# Interest Invoker API

> Declarative hover cards and tooltips without JavaScript

Published: 2024-12-04  
Tags: html, css, chrome  
Source: https://www.rege-dev.xyz/writing/interest-invoker

The Interest Invoker API lets you declaratively show popovers when user interest is detected—on hover, keyboard focus, or long-press. Combined with CSS Anchor Positioning, you can build tooltips and hover cards without JavaScript.

[Read more on Chrome Developers →](https://developer.chrome.com/blog/new-in-web-ui-io-2025-recap)

**Experimental feature**
  The Interest Invoker API is available as an origin trial in Chrome. The `interesttarget` attribute and `popover="hint"` are not yet stable.

## Basic Usage

Connect a trigger element to a popover using the `interesttarget` attribute. The popover appears when the user shows interest—hovering, focusing, or long-pressing.

```html
<button interesttarget="my-tooltip">
  Hover me
</button>

<div id="my-tooltip" popover="hint">
  Tooltip content here
</div>
```

## The "hint" Popover Type

Unlike `popover="auto"`, a hint popover doesn't close other open popovers. This is perfect for tooltips that should appear alongside menus or dialogs.

```html
<!-- Regular popover - closes others when opened -->
<div popover="auto">Menu content</div>

<!-- Hint popover - doesn't affect other popovers -->
<div popover="hint">Tooltip content</div>
```

## CSS Control

Fine-tune the behavior with CSS properties for timing and trigger styling.

```css
/* Control show/hide delays */
[interesttarget] {
  interest-target-delay: 200ms 100ms;
  /* first value: delay before showing */
  /* second value: delay before hiding */
}

/* Style trigger when interest is active */
[interesttarget]:has-interest {
  outline: 2px solid var(--accent);
}
```

## With CSS Anchor Positioning

Combine with CSS Anchor Positioning for automatic, responsive placement. The popover will reposition itself to stay within the viewport.

```css
/* Define the anchor on the trigger */
[interesttarget] {
  anchor-name: --trigger;
}

/* Position the popover relative to anchor */
[popover] {
  position: fixed;
  position-anchor: --trigger;
  position-area: top;
  margin-bottom: 0.5rem;
}
```

## Interactive Demo

_Interactive demo: https://www.rege-dev.xyz/writing/interest-invoker_

## Use Cases

- **Tooltips:** Show helpful hints on hover without blocking other UI.
- **User hover cards:** Preview user profiles when hovering @mentions.
- **Link previews:** Show page previews before clicking links.
- **Definition tooltips:** Explain terms inline without modal dialogs.

## vs. title Attribute

The `interesttarget` attribute replaces the unstylable `title` attribute. Unlike native tooltips, interest-invoked popovers are fully customizable, support rich content, and integrate with the accessibility tree properly.
