React Ripple component adds ripple effect to the host element.
Setup
Refer to PrimeReact setup documentation for download and installation steps for your environment.
Import
import PrimeReact from 'primereact/api';
import { Ripple } from 'primereact/ripple';
Getting Started
Ripple effect is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at your app's main container (e.g. App.js) using the PrimeReact class.
PrimeReact.ripple = true;
Note: That would be it to enable ripple on PrimeReact components, next section describes how to use it with your own components and standard elements.
Usage
Ripple is a component that needs to be imported and activated using PrimeReact.ripple = true
import { Ripple } from 'primereact/ripple';
<div className="p-ripple">
<Ripple />
</div>
Styling
Default styling of the animation adds a shade of white. This can easily be customized using css that changes the color of .p-ink element.
<div className="p-ripple purple">
<Ripple />
</div>
.p-ripple.purple .p-ink {
background: rgba(256,39,176,.3);
}
Theming
Ripple supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.
Resources
Visit the PrimeReact Ripple showcase for demos and documentation.