Avenra
Liquid GlassAPI Reference
Liquid GlassAPI Reference

createLiquidTooltip

Glass-styled tooltip that follows a trigger element.

createLiquidTooltip

Creates a glass tooltip that appears above or near a trigger element.

Basic Usage

import { createLiquidTooltip } from '@avenra/liquid-glass';

const tooltip = createLiquidTooltip('#my-btn', {
  label: 'Click for more info'
});

// Tooltip automatically attaches to #my-btn hover events by default

Props / Options

Extends LiquidGlassOptions plus:

PropTypeDefaultDescription
labelstring''Tooltip text content

Return Value — LiquidTooltipHandle

MemberTypeDescription
elementElementThe tooltip element
show()() => thisShow the tooltip
hide()() => thisHide the tooltip
setLabel(text)(string) => thisUpdate tooltip text
destroy()() => voidClean up the component
on('destroy', cb)undefinedFired on destruction

Notes

The tooltip is positioned dynamically above the trigger element and animates its appearance/disappearance using spring physics. It handles viewport edge collisions automatically to stay visible.

On this page