Code Monkey home page Code Monkey logo

react-ripples's Introduction

react-ripples

Material ripple effect, ripples everywhere

Attraction

  • โœ… Zero dependencies
  • ๐Ÿš€ Tiny and blazing fast (Pure Component)
  • โšก Typescript and definition file supported
  • ๐ŸŽจ Pure CSS animation
  • ๐ŸŒ SSR supported

Installation

$ npm install --save react-ripples

or

$ yarn add react-ripples

Usage

import Ripples from 'react-ripples'

render() {
  <Ripples>
    <button>Ripple Button</button>
  </Ripples>
}

API

createRipples([defaultProps])

Extends default props without HOC

import { createRipples } from 'react-ripples'

const MyRipples = createRipples({
  color: 'purple',
  during: 2200,
})

Props

static propTypes = {
  during: PropTypes.number,
  color: PropTypes.string,
}

static defaultProps = {
  during: 600,
  color: 'rgba(0, 0, 0, .3)',
}
Property Description
during The css animate duration [ms]
color The ripple's background color

react-ripples's People

Contributors

rwu823 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-ripples's Issues

Warning: Unknown event handler property `onPointerEnterCapture`. It will be ignored.

<Ripples
id={"navBtn" + capitalizeFirstLetter(props.content.label)}
className='lateralNavBtn w-full'
onClick={(event) => {
props.setCurrentPage({
pageName: capitalizeFirstLetter(props.content.label), index: props.index,
});
}}
color="var(--darkGrey)"
during={800}
placeholder={undefined} onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined}
>

In this piece of code the IDE is forcing me to add placeholder, onPointerEnterCapture and onPointerLeaveCapture props but when i look at the chrome console i see the error i put in the title

Doesn't work if any parent is not position:static

Love the effect, but the library is almost unusable due to this issue. Every ancestor of the component must be position:static, otherwise the positioning of the ripple is off. I'm guessing the click coordinates are determined based on the current positioning context rather than being relative to the whole document - if there's no known fix I might make a PR

Not working on if parent has position:absolute

Ripple effect does not work if the container is positioned via position:absolute; (i.e. floating button).

The problem seems to be the positioning of the s ripple element, which coordinates should be relative to the parent, but are absolute of the window. I tried making it position:fixed; however it is now over the parent and therefore not bounded anymore

disableRipple

If true, the ripple effect will be disabled.
โš ๏ธ Without a ripple there is no styling for :focus-visible by default. Be sure to highlight the element by applying separate styles with

Add Yarn 2 compatibility

The following error occurs with yarn 2

Cannot find module 'prop-types' or its corresponding type declarations.

Dist is requiring "React" instead of "react"

Hello,

Your build script transforms import 'react' intro require("React") (emphasis on the uppercase R) which causes problems when requiring this library as the app cannot find node_modules/React on case-sensitive filesystem (such as mine).

Do you think it would be possible to fix ? :)
Thanks in advance,

Giving error on docker build

Giving error

Property 'placeholder' is missing in type '{ children: Element; onClick: () => void; className: string; }' but required in type 'Pick<HTMLAttributes, "children" | "className" | "onError" | "color" | "slot" | "title" | "defaultChecked" | "defaultValue" | ... 243 more ... | "placeholder">'.

Please let me know if anyone finds a fix of this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.