@leafygreen-ui/ripple
TypeScript icon, indicating that this package has built-in type declarations

1.1.20 • Public • Published

Ripple

npm (scoped)

Installation

Yarn

yarn add @leafygreen-ui/ripple

NPM

npm install @leafygreen-ui/ripple

Example

import { registerRipple } from '@leafygreen-ui/ripple';

// JavaScript Example
const button = document.querySelector('#my-button');
const buttonOptions = {
  variant: 'danger',
  darkMode: false,
};

registerRipple(button, buttonOptions);

// React Example
function Button({ options }) {
  const ref = React.useRef(null);

  useEffect(() => {
    if (ref.current) {
      registerRipple(ref, options);
    }
  }, [ref, options]);
}

Arguments

Argument Type Description Default
ref HTMLElement HTMLElement that ripple effect should be applied to
options Options that specify coloring and size of ripple
options.variant 'primary', 'info', 'default', 'danger', 'secondaryDanger' Determines color of ripple effect
options.darkMode boolean Determines if the ripple effect will be rendered in dark mode false

NOTE: In order for this to work as expected, the target element must have the property overflow:hidden set

/@leafygreen-ui/ripple/

    Package Sidebar

    Install

    npm i @leafygreen-ui/ripple

    Weekly Downloads

    41,642

    Version

    1.1.20

    License

    Apache-2.0

    Unpacked Size

    45.2 kB

    Total Files

    24

    Last publish

    Collaborators

    • hswolff
    • thesonofthomp
    • brookescarlett
    • shaneeza
    • stephl3
    • _tsck