Ripple
Animation

Ripple is a plugin that achieve Material ripple animation.

Styles

You can customize the default styles of this component inside tailwind.config.js setting theme.extend.xtendui.ripple see css customization. Check xtendui/src/ripple.css.js for default styles.

Javascript

Import the javascript file with import 'xtendui/src/ripple'.

Initialize manually within javascript with new Xt.Ripple(document.querySelector('.my-container'), {/* options */}).

Usage

Initialize with javascript on the selectors you want the ripple effect on, options.onlyInside takes care of activating only on interactive elements.

Style ripple effect with css.

Options

Here are the main javascript options.

SyntaxDefault / ArgumentsDescription
Optiondebug:BooleanfalseDebug on console
OptionsizeInitial:Boolean0.3Initial size factor
OptiononlyInside:Query'a, button, .xt-button'Only if selector else query closest

Match Media

You can add additional options that gets added on match media query. You can use different queries with different and nested options.

SyntaxDefault / ArgumentsDescription
Optionmatches:ObjectfalseAdd additional options on match media query

Util

You can get self object on Xtend UI components with the constructor or Xt.get.

new Xt.Ripple(document.querySelector('.my-container'), {}).then(self => {})

// or

Xt.get({ name: 'xt-ripple', el: document.querySelector('.my-container') }).then(self => {})

You can set default options for all components of the same type, with Xt.options.

Xt.options['xt-ripple'] = {
  debug: true,
}

By default components are loaded and initialized only when inside viewport or instantly if self.container is not visible (display: none).

You can force global observer options or singular component observer options passing this option.

SyntaxDefault / ArgumentsDescription
Optionobserver:Boolean|nullnullForce enable or disable intersection observer

Listen

Listen to events, for listeners use this guideline.

SyntaxDOM ElementDescription
Eventon.xt.ripplecontainerActivation event (event e.detail is original event)
Eventoff.xt.ripplecontainerDeactivation event (event e.detail is original event)
Eventsetup.xt.ripplecontainerSetup event
Eventinit.xt.ripplecontainerInit or reinit event
Eventstatus.xt.ripplecontainerStatus event (enabled or disabled)
Eventdestroy.xt.ripplecontainerDestroy event

Properties

Access properties by getting self object.

SyntaxDescription
Propertyself.componentName:StringComponent name (used in Xt.get)
Propertyself.options:ObjectFinal options
Propertyself.initial:BooleanIf initial or reset activation
Propertyself.disabled:BooleanIf component disabled
Propertyself.container:NodeContainer node
Propertyself.inner:NodeInner node that contains the ripples
Propertyself.targets:ArrayTargets nodes
Propertyself.size:NumberInitial size of ripple
Propertyself.top:NumberInitial top position of ripple
Propertyself.left:NumberInitial left position of ripple
Propertyself.sizeFinal:NumberFinal size of ripple
Propertyself.scaleFinal:NumberFinal scale of ripple

Methods

Call methods by getting self object.

SyntaxDescription
Methodself.reinit()Reinit component
Methodself.disable()Disable component
Methodself.enable()Enable component
Methodself.destroy()Destroy component