npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

haptic-ripple

v1.0.8

Published

haptic feedback ripple effect for web interfaces

Readme

HapticRipple Overview

HapticRipple is a lightweight JavaScript library for creating customizable ripple effects on UI elements - similar to the material design ripple effect but with more customization options. It enhances tactile feedback for clicks and touches on interactive elements.

Live Demo

Installation Options

  1. npm/yarn:

    npm install haptic-ripple

    or

    yarn add haptic-ripple
  2. CDN (for direct browser usage):

    <script src="https://cdn.jsdelivr.net/npm/haptic-ripple/dist/index.umd.js"></script>
  3. Local download: Download the UMD build and include it in your project.

Basic Usage

When using with bundlers:

import { createHapticRipple } from "haptic-ripple";

const ripple = createHapticRipple();
ripple.enable("button"); // Apply to all buttons

When using via CDN or local UMD file:

// Access through the HapticRipple namespace
const ripple = HapticRipple.createHapticRipple({
    color: "rgba(255, 255, 255, 0.7)",
    size: 20,
    duration: 400,
});

ripple.enable("#my-button");

Features

  • 🎨 Fully customizable (color, size, duration, opacity, scale, easing)
  • 📱 Mobile-first design with touch event support
  • 🧩 Simple API with both class and factory function approaches
  • 🪄 Multiple independent instances supported
  • 🌈 CSS variable integration for theming

Configuration Options

You can customize the ripple effect with these parameters:

| Property | Type | Default | Description | | -------------- | ------ | -------------- | ---------------------------------------- | | color | string | "rgb(0, 0, 0)" | CSS color value (supports CSS variables) | | size | number | 16 | Initial ripple diameter in pixels | | duration | number | 300 | Animation duration in milliseconds | | initialOpacity | number | 0.3 | Starting opacity (0-1) | | scale | number | 4 | Growth multiplier during animation | | easing | string | "ease-out" | CSS animation timing function |

Common Use Cases

  1. Basic buttons:

    const buttonRipple = createHapticRipple({
        color: "rgba(255, 255, 255, 0.7)",
        size: 20,
    });
    
    buttonRipple.enable(".my-button");
  2. Larger UI elements (cards, panels):

    // Avoid extreme combinations
    createHapticRipple({
        size: 8, // Too small
        scale: 100, // Excessive scaling
    });
    const cardRippleEffect = createHapticRipple({
        color: "rgba(0, 0, 200, 0.3)",
        size: 600,
        duration: 500,
        initialOpacity: 0.125,
        scale: 3,
    });
    
    cardRippleEffect.enable(".card-container");

    For larger UI elements like cards or panels, slower animations with larger initial sizes prevents the animation from appearing too aggressive or abrupt.

  3. Using CSS variables for theming:

    :root {
        --primary-ripple-color: rgba(76, 110, 245, 0.7);
        --danger-ripple-color: rgba(250, 82, 82, 0.5);
    }
    createHapticRipple({
        color: "var(--primary-ripple-color)",
    }).enable(".primary-action");
  4. Dynamically updating properties:

    const adaptiveRipple = createHapticRipple();
    
    // Update properties later
    adaptiveRipple.update({
        color: "#ff000080",
        duration: 500,
        scale: 6,
    });

API Reference

createHapticRipple(options?)

Factory function returns controller object:

function createHapticRipple(options?: HapticRippleOptions): {
    enable: (selector: string | HTMLElement | HTMLElement[]) => void;
    disable: (selector: string | HTMLElement | HTMLElement[]) => void;
    update: (newOptions: HapticRippleOptions) => void;
};

Class API

import { HapticRipple } from "haptic-ripple";

const ripple = new HapticRipple(options);
ripple.enable(".elements");
ripple.updateOptions(newOptions);
ripple.disable("#specific-element");

Troubleshooting

Ripple Not Visible?

  • Check z-index conflicts
  • Verify parent has position: relative
  • Ensure no overflow:hidden is obscuring the effect
  • Confirm element isn't disabled

Mobile Issues

/* Add to interactive elements */
touch-action: manipulation;

Browser Support

Works in all modern browsers

License

MIT License