Code Monkey home page Code Monkey logo

react-touch-ripple's Introduction

React Touch Ripple

Create ripple effect from Material Design with React

Build Status GitHub license npm

简体中文 Simplified Chinese

Install

npm install react-touch-ripple --save

Usage

Basic Usage

import Ripples from 'react-touch-ripple';

const Demo = () => (
    <Ripples>
        <button>CLICK</button>
    </Ripples>
);
ReactDOM.render(<Demos />, tree);

Custom Styles

A quick note here: <Ripples> is a box wrapping around its child component (in this case, <button>) and if you are adding styles such as box-shadow or margin, make sure you apply them directly to the wrapper component instead of the child component.

const StyledWrapperDemo = () => (
    <Ripples 
        className="deep-shadow"
        style={{ margin: '10px 0', }}
    >
        <button>CLICK</button>
    </Ripples>
);

Changing Color

The background-color of the ripples are default to currentColor. If you are to change it, pass it as a prop to <Ripples>.

const ColoredDemo = () => (
    <Ripples color="#00a1e9">
        <button>CLICK</button>
    </Ripples>
);

An important note: opacity: 0.3 is already set on the ripples. So you just need to pass in the color without an alpha.

<Ripples color="rgba(0, 109, 37, 0.5)">

This is UNNESSARY and will behave out of your expectation.

Center Ripples

Provide center property on the <Ripples> will center every ripple it created. This is usually useful when you are applying ripples on a switch or checkbox component. See demos for more information.

const RippleSwitch = () => (
    <Ripples center>
        <Switch />
    </Ripples>
);

Design Guidelines

See Choreography

License

React Touch Ripple is licensed as MIT

react-touch-ripple's People

Contributors

froyog avatar zmnv avatar

Watchers

James Cloos avatar

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.