Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-tooltip>

@methane-ui/ui~9.0 KB brotli (cold + Lit)~2.6 KB marginal

Non-focus-stealing tooltip with progressive interestfor detection, hover/focus/long-press intent fallback, and adopted CSSStyleSheet positioning.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-tooltip> (@methane-ui/ui)
Hover or focus trigger
Ready · interact with <mth-tooltip>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/tooltip"></script>
<mth-tooltip placement="top" delay="250">Example</mth-tooltip>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseControls open visibility of the tooltip.
contentcontentstring""Plain-text tooltip message when slot="content" is not provided.
placementplacementstring"top"Preferred placement relative to the trigger.
delaydelaynumber250Intent show delay in milliseconds.
offsetoffsetnumber8Pixel distance between trigger and tooltip surface.
disableddisabledbooleanfalsePrevents the tooltip from opening on user intent.
forceFallbackforce-fallbackbooleanfalseForces JS positioning and non-top-layer fallback mode.
anchor—Element | { getBoundingClientRect(): DOMRect } | DOMRect | nullnullOptional explicit Element, VirtualAnchor, or DOMRect anchor target.

Events

EventDetail TypeDescription
mth-openvoidCancelable event fired before showing the tooltip.
mth-after-openvoidFired once tooltip becomes visible.
mth-close{ reason: string }Cancelable event fired before hiding the tooltip.
mth-after-close{ reason: string }Fired once tooltip is hidden.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Escapebothopendismisses tooltip without moving focus

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 1 APG keyboard transitions across LTR/RTL.mth-tooltip.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(disabled).Conformance suite
i18nRoutes 1 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test