j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Tooltip

A short description of a control shown on hover and focus; role tooltip linked by aria-describedby, a 1px overlay border on the raised surface, no arrow.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

default

Markup
<j3w1-tooltip id="example-tooltip-default"><div class="tooltip">
  <button class="tooltip-trigger" type="button" aria-describedby="example-tooltip-default-tt-reload">Reload</button>
  <div class="tooltip-popup" role="tooltip" id="example-tooltip-default-tt-reload">Reload the window and keep the layout.</div>
</div></j3w1-tooltip>

with-shortcut

Markup
<j3w1-tooltip id="example-tooltip-with-shortcut"><div class="tooltip">
  <button class="tooltip-trigger" type="button" aria-describedby="example-tooltip-with-shortcut-tt-split">Split</button>
  <div class="tooltip-popup" role="tooltip" id="example-tooltip-with-shortcut-tt-split">Split the focused container horizontally <kbd class="tooltip-shortcut">Mod+h</kbd></div>
</div></j3w1-tooltip>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/tooltip.css';
import '@j3w1/ui/register/tooltip';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy tooltip --out ./vendor/j3w1/tooltip

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.
openbooleanCurrent tooltip visibility. Read only.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.
show(): voidShow the description unless dismissed in this hover/focus session.
hide(): voidHide and cancel pending timers.

events

NameType / signatureMeaning

Dependencies and verification

Registered components: none. Style dependencies: none.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Tooltip tooltip

  • Family: Feedback and overlays
  • Maturity: stable
  • Priority: R1
  • Since: 0.1.0
  • Custom widget: APG tooltip: a trigger with aria-describedby pointing at an element with role=tooltip, shown on hover and focus, hidden on Escape — APG pattern
  • specified
  • demonstrated

A short description of a control shown on hover and focus; role tooltip linked by aria-describedby, a 1px overlay border on the raised surface, no arrow.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
popup.bgcolor.surface.raisedapproveduse#140b0bD-041 surface.raised: color.primitive.modern.raised.
popup.bordercolor.border.overlayapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
popup.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
shortcut.textcolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
shortcut.bordercolor.border.controlapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
trigger.textcolor.action.tertiary.textapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
trigger.bg-hovercolor.action.tertiary.hover-bgobserveduse#1c0a09Ghost and icon button hover.
trigger.ringcolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
popup.zz.popoverobserveduse10

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateDescriptionWith shortcut
default
hover
focus-visible
open
closed

Purpose

Describes a control without being its name: what an icon button does, its shortcut, why it is disabled. Anything needed to use the control belongs in the control or its label; anything interactive is a popover.

Anatomy

Parts as listed in the anatomy; no arrow, shadow or radius.

States

StateVisualNon-colour channel
defaulttrigger at rest; popup shown for the demonstrationaria-describedby on the trigger
hovertrigger background → color.action.tertiary.hover-bg; popup after 300 ms; it hides 300 ms after the pointer leaves trigger and popupcursor: pointer; the popup
focus-visible1px dashed color.interaction.focus.ring at −2px on the trigger; popup at oncethe ring; the popup
openpopup visible, 1px color.border.overlay on color.surface.raisedpopup in the accessibility tree
closedpopup absent; trigger unchangedhidden; the description is still read from the DOM

The popup has no hover, pressed or focus state; it is not interactive.

Keyboard

As in the key table. Escape does nothing else, so a dialog behind the trigger stays open. The popup never receives focus and contains nothing focusable.

Accessibility

The popup stays open while the pointer is over the trigger or the popup (WCAG 1.4.13: hoverable, dismissible, persistent). The trigger has its own accessible name; the tooltip never supplies it. Touch has no hover: offer the description by long-press or inline. Text meets 4.5:1; the popup border and the shortcut border 3:1.

Portability

A bordered box of text; placement is the host’s positioning primitive. A toolkit with a native tooltip uses it with the border and background tokens and records any radius it cannot remove.

Non-examples

A rounded bubble with an arrow. A shadow, or a fade longer than 150 ms. The tooltip as an icon button’s only accessible name. A link or button inside. Opening on focus but not hover, or on hover with no delay. A title attribute. Following the pointer.

Contrast report

10 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
tooltip default textdefaulttextcolor.text.default #e99499color.surface.raised #140b0b8.464.5pass
tooltip default borderdefaultuicolor.border.overlay #c81a1acolor.surface.raised #140b0b3.343pass
tooltip hover texthovertextcolor.action.tertiary.text #e99499color.action.tertiary.hover-bg #1c0a098.354.5pass
tooltip focus-visible textfocus-visibletextcolor.action.tertiary.text #e99499color.surface.canvas #0000009.164.5pass
tooltip focus-visible outlinefocus-visibleuicolor.interaction.focus.ring #e53935color.surface.canvas #0000004.973pass
tooltip open textopentextcolor.text.default #e99499color.surface.raised #140b0b8.464.5pass
tooltip open borderopenuicolor.border.overlay #c81a1acolor.surface.raised #140b0b3.343pass
shortcut on the tooltip—textcolor.text.bright #ffa2a7color.surface.raised #140b0b10.144.5pass
shortcut key border on the tooltip—uicolor.border.control #c81a1acolor.surface.raised #140b0b3.343pass
trigger text on the canvas—textcolor.action.tertiary.text #e99499color.surface.canvas #0000009.164.5pass

Keys

KeyAction
TabFocusing the trigger shows the tooltip; leaving it hides the tooltip.
EscapeHides the tooltip without moving focus; the trigger's own Escape behaviour is not triggered.
Enter / SpaceAct on the trigger as usual; the tooltip hides on activation.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Related: icon-button popover kbd toolbar menu

Stress fixtures: FX-LONG FX-320 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-OVERFLOW FX-STATE-MATRIX