Tooltip

Material Design 3 plain tooltip web component, built on the native Popover API.

  • 1.6 KB gzipped
  • @lit-material/tooltip 0.0.3
  • Renders on the server

Example

Install

npm install @lit-material/tooltip @lit-material/tokens
import "@lit-material/tooltip";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-tooltip>

Material Design 3 plain tooltip — a short text label that appears near an anchor element on hover or keyboard focus, built on the native Popover API (popover="manual", so top-layer rendering escapes clipping/overflow ancestors) the same way lit-material-menu and lit-material-snackbar build on it.

Properties

PropertyAttributeTypeDefaultDescription
openopenbooleanfalse
anchoranchorstring | undefinednoneid of the anchor element to position against and describe. See also anchorElement.
showDelayshow-delaynumber500Hover/focus delay (ms) before showing.
hideDelayhide-delaynumber200Delay (ms) before hiding once the anchor is no longer hovered/focused.
anchorElementproperty onlyHTMLElement | undefinednoneThe element this tooltip describes and positions against.

Slots

SlotDescription
defaultThe tooltip's text.

CSS parts

PartDescription
tooltipThe host itself (background, padding, shape).

Source on GitHub npm