Avenra
Liquid GlassAPI Reference
Liquid GlassAPI Reference

createLiquidButton

Animated glass button with spring-driven interactions.

createLiquidButton

Creates a glass-styled button with built-in hover and click animations driven by spring physics.

Basic Usage

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

const btn = createLiquidButton('#my-btn', {
  label: 'Save Changes'
});

btn.on('click', () => console.log('Saved!'));

Props / Options

Extends LiquidGlassOptions plus:

PropTypeDefaultDescription
labelstringundefinedButton text content

Return Value — LiquidButtonHandle

MemberTypeDescription
elementElementThe button element
setLabel(text)(string) => thisUpdate button label text
destroy()() => voidClean up the component
on('click', cb)MouseEventFired on click
on('mouseenter', cb)MouseEventFired on hover start
on('mouseleave', cb)MouseEventFired on hover end
on('mousedown', cb)MouseEventFired on press
on('mouseup', cb)MouseEventFired on release
on('destroy', cb)undefinedFired on destruction

On this page