1. vue-ripple-directive
Vue Material Ripple Effect Directive
vue-ripple-directive
Package: vue-ripple-directive
Created by: PygmySlowLoris
Last modified: Tue, 28 Jun 2022 20:13:44 GMT
Version: 2.0.1
License: MIT
Downloads: 25,267
Repository: https://github.com/PygmySlowLoris/vue-ripple-directive

Install

npm install vue-ripple-directive
yarn add vue-ripple-directive

Material Ripple Effect

Material Ripple Effect as Vue Directive.

This directive it's meant to be used in any element in which you like to achieve such ripple effect.

Live Demo

Installation

npm install vue-ripple-directive --save

Important Notice

The directive will work better if the element where you attach it is relative positioned.
Although the directive will try to set position: relative if the element does not have this property.
This is because the ripple since v2.0.* is position: absolute, to avoid trailing issues when elements with the directive in the UI move.

Options

Optional parameter to pass to the directive.

Parameter Type Values
color-value String Default: 'rgba(0, 0, 0, 0.35)'.
Accepts either HEX, RGB & RGBA values. For optimal look use RGBA with low opacity.

Modifiers

By default this directive attaches a click handler to the element as well as the transition is set for 600ms.
For those who wants to modify the same, just pass modifiers to the directive:

v-ripple.mouseover.500

Can also modify only one

v-ripple.mouseover

Sample & Usage

First you need to import the directive and add it to Vue.

import Ripple from 'vue-ripple-directive'

Vue.directive('ripple', Ripple);

Then use on any element you want to achieve the effect.

<div v-ripple class="button is-primary">This is a button</div>

If you want a custom color just pass a color parameter as string. It's best if you use RGBA colors to achieve a greater effect.

<div v-ripple="'rgba(255, 255, 255, 0.35)'"  class="button">I have different color</div>

Global settings

You can set the default color and z-index for all your ripples as the following example

import Ripple from 'vue-ripple-directive'

Ripple.color = 'rgba(255, 255, 255, 0.35)';
Ripple.zIndex = 55;
Vue.directive('ripple', Ripple);

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin