DEV Community

Nikhil Chandra Roy
Nikhil Chandra Roy

Posted on

Ripple button tutorial with bootstrap 5 + mdb

Hello there,
Today we are going to discuss here ripple button in bootstrap 5 and mdbootstrap.

For uses bootstrap 5 and MDB we first include CSS and js in our HTML page.

<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Font Awesome -->
    <link href="" rel="stylesheet" />
    <!-- Google Fonts -->
    <link href=",400,500,700&display=swap" rel="stylesheet" />
    <!-- MDB -->
    <link href="" rel="stylesheet" />

<section class="section__ripple">
            <button class="btn btn-danger">
                Ripple danger

    <!-- MDB -->
    <script type="text/javascript" src=""></script>

Enter fullscreen mode Exit fullscreen mode

As you can see a button with ripple effect when click that button, we can do any bootstrap button same effect.
for example:

<button class="btn btn-primary">Ripple Primary</button>
            <button class="btn btn-success">Ripple Success</button>
            <button class="btn btn-secondary">Ripple Secondary</button>
            <button class="btn btn-warning">Ripple Warning</button>
            <button class="btn btn-danger">Ripple Danger</button>
            <button class="btn btn-dark">Ripple Dark</button>
            <button class="btn btn-light">Ripple Light</button>

Enter fullscreen mode Exit fullscreen mode

but what if we want to customize the ripple effect or we need that effect in a different HTML tag instant of a button?

here is one example without a button we using div.

<div class="w-25 ripple bg-primary " style="height: 200px;">


Enter fullscreen mode Exit fullscreen mode

and for customize, we can add an attribute like


Enter fullscreen mode Exit fullscreen mode


 <div class="w-25 ripple bg-primary " data-mdb-ripple-duration="5s" data-mdb-ripple-color="#f00" style="height: 200px;">


Enter fullscreen mode Exit fullscreen mode

for a full tutorial about the ripple effect we can follow
mdb ripple tutorial

This is a very short tutorial about ripple, hope next time we will discuss further more about MDB.
Thanks for stay with me, if you like this post don't forget to write your opinion in the comment below.

Top comments (2)

brewhousedigital profile image
Brewhouse Digital • Edited

Great article, Nikhil!
For a little better formatting, add the name of the coding language to your code blocks. something like:

formatting code blocks example

nikhilroy2 profile image
Nikhil Chandra Roy

thanks for adivce