Skip to content

Examples

Tooltip on icon button

A tooltip gives an icon-sm button the label its glyph alone cannot carry.

Preview

Production API key sk_live_...9frA
HTML
<bs:bsui-stack direction="row" gap="2" align="center">
  <bs:bsui-text content="Production API key" variant="label" tag="span" />
  <bs:bsui-text content="sk_live_...9frA" variant="code" tag="span" />
  <bs:bsui-tooltip openDelay="0">
    <bs:bsui-tooltip-trigger trigger_label="?" trigger_variant="ghost" trigger_size="icon-sm" />
    <bs:bsui-tooltip-popup content="Keys are shown once and stored hashed. Rotate them from Settings." />
  </bs:bsui-tooltip>
</bs:bsui-stack>

How it works

The tooltip store opens on hover and focus through directives on its trigger button, so keyboard users get the same hint as pointer users. Context links the popup to the trigger for assistive tech, and it closes on blur, Escape, or pointer exit after the close delay.

Every behaviour on this page is the WordPress Interactivity API: each component registers its own store, seeds its state in a server rendered context, and wires events with directives in the markup above. There is no page specific JavaScript.