Touch Ripple

Framework7 Material Theme comes with great an dynamic implementation of Material Touch Ripple effect.

It is enabled by default for MD theme.

However, you may disable it by passing touch.mdTouchRipple:false app parameter.

Ripple Elements

By default it is enabled for the elements that match to the following CSS selector:

  1. .ripple, .link, .item-link, .list-button, .links-list a, .button, button, .input-clear-button, .dialog-button, .tab-link, .item-radio, .item-checkbox, .actions-button, .searchbar-disable-button, .fab a, .checkbox, .radio, .data-table .sortable-cell:not(.input-cell), .notification-close-button, .stepper-button, .stepper-button-minus, .stepper-button-plus, .menu-item-content

which are defined in touch.touchRippleElements app parameter.

So when you touch such elements you will see so called “ripple” effect.

If you need to add “ripple” effect for any custom element you may add this element’s selector to touch.touchRippleElements parameter or just add ripple class.

  1. <a href="#" class="my-link ripple">Link With Ripple Effect</a>

Ripple Wave Color

If you want to change color of “ripple” wave on some element, then you may add ripple-**[color]** class to required element, where **[color]** class is the one of default Theme Colors, for example:

  1. <a href="#" class="button ripple-color-red">Button With Red Ripple</a>

or you may specify it using CSS by referencing .ripple-wave element:

  1. .button .ripple-wave {
  2. background-color: #ff0000;
  3. }

or with CSS variable:

  1. .button .ripple-wave {
  2. --f7-touch-ripple-color: #ff0000;
  3. }

Disable Ripple For Specific Elements

If you want to disable ripple element for specific elements, then you may add no-ripple class to such elements:

  1. <a href="#" class="button no-ripple">Button Without Ripple Effect</a>

CSS Variables

Below is the list of related CSS variables (CSS custom properties).

  1. :root {
  2. --f7-touch-ripple-black: rgba(0, 0, 0, 0.1);
  3. --f7-touch-ripple-white: rgba(255, 255, 255, 0.3);
  4. --f7-touch-ripple-color: var(--f7-touch-ripple-black);
  5. }
  6. .theme-dark {
  7. --f7-touch-ripple-color: var(--f7-touch-ripple-white);
  8. }