StartFoundationsComponentsContent

Popover

A popover is a small panel that opens next to a button and can hold buttons, links, and fields. It doesn't block the page.

Stable Figma
OverviewUsageAPIAccessibility
Filters Open Closed Apply
<tk-popover label="Filters">
  <tk-button slot="trigger">Filters</tk-button>
  <tk-checkbox>Open</tk-checkbox>
  <tk-checkbox>Closed</tk-checkbox>
  <tk-button size="small" variant="primary">Apply</tk-button>
</tk-popover>

Anatomy

Part What it is
tk-popover the element; it opens and closes the panel and wires the ARIA
trigger slot one button that opens it: a tk-button or tk-icon-button
default slot the content, interactive or not
surface part the panel

There is no arrow, header, footer, or close button. Compose your own inside the content.

Trigger modes

Ada Lovelace

Engineer in London. 168 followers.

Follow
<tk-popover trigger="hover" label="Ada Lovelace">
  <tk-button slot="trigger" variant="ghost">Ada Lovelace</tk-button>
  <p>Engineer in London. 168 followers.</p>
  <tk-button size="small">Follow</tk-button>
</tk-popover>
  • click (default): a click, Enter, or Space on the trigger opens and closes the panel. Use it for anything people open on purpose.
  • hover: opens on pointer hover, on keyboard focus, and on a touch tap, so everyone can reach it. Use it for previews whose content is also available elsewhere.
  • Opening never moves focus into the panel. Keyboard users press Tab to reach the content, which comes right after the trigger.

Opening and closing

  • The panel closes on Esc, on a press outside, when focus leaves it, and when the trigger scrolls out of view. Esc returns focus to the trigger.
  • In hover mode, it opens after 400ms of hover and closes 300ms after the pointer leaves, so the pointer can move onto the panel. Focus and tap open it at once.
  • It never closes on a timer.
  • It opens below the trigger and moves above when there's no room below. It shows instantly, with no animation.
  • show(), hide(), and toggle() open and close it from code.

Contextual help

To explain a setting or field, put a short heading, a sentence or two, and at most one link behind an info button.

Billing cycles

Your cycle starts the day you subscribe and renews on the same date each month.

Read more about billing
<tk-popover label="About billing cycles">
  <tk-icon-button slot="trigger" label="About billing cycles"><tk-icon name="info"></tk-icon></tk-icon-button>
  <h4>Billing cycles</h4>
  <p>Your cycle starts the day you subscribe and renews on the same date each month.</p>
  <tk-link href="/billing">Read more about billing</tk-link>
</tk-popover>
  • Use click, not hover: help is something people open on purpose.
  • Name the icon button with label, and name the panel too.
  • Never put the only copy of essential information here. If people need it to succeed, put it on the page.

Sizing

  • The panel fits its content up to 320px wide. Change that with --tk-popover-max-width.
  • Set --tk-popover-max-height to cap the height; the content then scrolls vertically.
  • Set --tk-popover-padding: 0 to let an image reach the panel's edge.