Detects directional swipe gestures via Pointer Events
CngxSwipeDismiss
DirectivePrimaryv0.1.0WCAG AA
projects/common/interactive/gestures/swipe-dismiss.directive.ts
Import#
import { CngxSwipeDismiss } from '@cngx/common/interactive'
Description#
Detects directional swipe gestures via Pointer Events.
Generic atom usable for drawers (swipe-to-close), bottom sheets,
carousels, and dismissible cards. Emits swiped when the gesture
completes past the threshold. Exposes swiping and swipeProgress
signals for real-time visual feedback during the gesture.
Close drawer on swipe-left
<nav [cngxDrawerPanel]="drawer"
cngxSwipeDismiss="left" (swiped)="drawer.close()">
…
</nav>Bottom sheet with progress
<div cngxSwipeDismiss="down" #swipe="cngxSwipeDismiss"
[style.transform]="'translateY(' + (swipe.swipeProgress() * 100) + '%)'">
…
</div>Metadata#
Index#
Inputs#
direction#
SwipeDirectioninput()Required
Direction of the swipe that triggers dismissal.
default
{ alias: 'cngxSwipeDismiss' }Outputs#
Instance Properties#
swipeProgress#
unknownReadonly
Progress of the current swipe from 0 to 1 (clamped).
this.swipeProgressState.asReadonly()swiping#
unknownReadonly
Whether a swipe gesture is currently in progress.
this.swipingState.asReadonly()