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 defaultProps / Options
Extends LiquidGlassOptions plus:
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | '' | Tooltip text content |
Return Value — LiquidTooltipHandle
| Member | Type | Description |
|---|---|---|
element | Element | The tooltip element |
show() | () => this | Show the tooltip |
hide() | () => this | Hide the tooltip |
setLabel(text) | (string) => this | Update tooltip text |
destroy() | () => void | Clean up the component |
on('destroy', cb) | undefined | Fired 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.