Skip to main content
cngx-src documentation

CngxRipple

DirectivePrimaryv0.1.0

projects/common/interactive/ripple/ripple.directive.ts

Import#

import { CngxRipple } from '@cngx/common/interactive'

Description#

Touch/click ripple feedback without Material dependency.

Creates a <span class="cngx-ripple__wave"> on pointer contact, positions it via CSS custom properties (--cngx-ripple-x, --cngx-ripple-y, --cngx-ripple-size), and removes it after the animation completes. ALL visual treatment - color, duration, shape - is the consumer's CSS responsibility.

Ships a companion _ripple.scss with sensible defaults.

Button with ripple

<button cngxRipple>Click me</button>

Centered ripple for icon buttons

<button cngxRipple [rippleCentered]="true" class="icon-btn">
  <mat-icon>favorite</mat-icon>
</button>

Disable ripple

<button cngxRipple [rippleDisabled]="isReducedMotion()">Click</button>

https://cngxjs.github.io/cngx/examples/#/common/interactive/ripple/base/button-ripples https://cngxjs.github.io/cngx/examples/#/common/interactive/ripple/base/card-with-ripple

Metadata#

Host#

Relationships

Index#

Inputs#

centered#boolean
input()

Whether the ripple originates from the center of the host.

default false, { alias: 'rippleCentered' }
color#string
input()

Ripple color - passed as --cngx-ripple-color on the wave element.

default 'currentColor', { alias: 'rippleColor' }
disabled#boolean
input()

Whether the ripple effect is disabled.

default false, { alias: 'rippleDisabled' }

Instance Properties#

active#unknown
Readonly

Whether a ripple animation is currently playing.

this.activeState.asReadonly()

HostBindings#

BindingExpression
[style.position]"relative"
[style.overflow]"hidden"

HostListeners#

EventHandler
(pointerdown)pointerdown()