Ripple
Bootstrap 5 Ripple
The ripple method generates a radial effect in the form of a visual ripple that expands outward from the user's touch. This visual feedback, known as a ripple, serves to indicate touch events, offering users a clear signal that an element is being interacted with.
Note: Read the API tab to find all available options and advanced customization
*
*
UMD autoinits are enabled
by default. This means that you don't need to initialize
the component manually. However if you are using MDBootstrap ES format then you should pass
the required components to the initMDB
method.
Basic example
Add data-mdb-ripple-init
attribute to the clickable element to initialize the ripple effect.
You can easily apply the ripple effect to images by using the data-mdb-ripple-init
attribute.
Colors
By using data-mdb-ripple-color
attribute you can change the color of the ripple.
You can use the colors from the basic MDB palette, for example
data-mdb-ripple-color="primary"
or data-mdb-ripple-color="danger"
:
You can also use any CSS color name:
Or simply use the hex color code:
Duration
By using data-mdb-ripple-duration
attribute you can modify the duration of the
ripple.
Centered
If you add data-mdb-ripple-centered="true"
attribute the ripple always starts in
the center of the element instead of in the touched place.
Unbound
If you use data-mdb-ripple-unbound="true"
attribute, the ripple won't be bonded to
the given element and it will exceed its borders.
Radius
By using data-mdb-ripple-radius
attribute you can modify the radius of the
ripple. The numeric value is expressed in pixels, for example:
data-mdb-ripple-radius="10"
JavaScript implementation
You can apply the ripple to multiple elements at once by using JavaScript. In the example
below, we added a sample class .example-class
to the
<a>
element wrapping the image, and then we use JavaScript to apply ripple
to this class.
You can apply the ripple to any selector - classes, ID's or even native HTML elements.

Card title
Some quick example text to build on the card title and make up the bulk of the card's content.
Button
Card title
Some quick example text to build on the card title and make up the bulk of the card's content.
Button
Card title
Some quick example text to build on the card title and make up the bulk of the card's content.
ButtonRipple - API
Import
Importing components depends on how your application works. If you intend to use the MDBootstrap ES
format, you must
first import the component and then initialize it with the initMDB
method. If you are going to use the UMD
format,
just import the mdb-ui-kit
package.
Usage
Via data attributes
Using the Ripple method doesn't require any additional JavaScript code - simply add
data-mdb-ripple-init
attribute to
element you want to use ripple effect on
and use other data attributes to set all options.
For ES
format, you must first import and call the initMDB
method.
Via javascript
Via jQuery
Note: By default, MDB does not include jQuery and you have to add jQuery to the project on your own.
Options
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to
data-mdb-
, as in data-mdb-ripple-color=""
.
Name | Type | Default | Description |
---|---|---|---|
rippleCentered
|
Boolean | false |
Centers the position of ripple |
rippleColor |
String | '' |
Changes color of ripple |
rippleDuration
|
String | '500ms' |
Sets duration of animation |
rippleRadius |
Number | 0 |
Sets radius value |
rippleUnbound
|
Boolean | false |
Sets whether the effect should go beyond the wrapper's boundaries |
Methods
Name | Description | Example |
---|---|---|
dispose
|
Manually dispose of component | ripple.dispose() |
getInstance
|
Static method which allows you to get the ripple instance associated to a DOM element. |
Ripple.getInstance(rippleElement)
|
getOrCreateInstance
|
Static method which returns the ripple instance associated to a DOM element or create a new one in case it wasn't initialized. |
Ripple.getOrCreateInstance(rippleElement)
|