Interactions

Press

Normalizes the press event across different browsers and devices.

Import

Import the Press primitives from ng-primitives/interactions.

import { NgpPress } from 'ng-primitives/interactions';

Usage

Assemble the press directives in your template.

<div
  ngpPress
  (ngpPressStart)="onPressStart()"
  (ngpPressEnd)="onPressEnd()"
  (ngpPressChange)="onPressChange($event)"
></div>

API Reference

The following directives are available to import from the ng-primitives/interactions package:

NgpPress

The ngpPress directive listens for press events on an element. This is particularly useful for supporting press events on touch devices, where press events are not handled consistently.

  • Selector: [ngpPress]
  • Exported As: ngpPress
Event emitted when the press state changes. Whether press events are disabled. Event emitted when the press starts. Event emitted when the press ends.

Data Attributes

Attribute Description
data-press Applied when the element is being pressed.

Copyright © 2024 Angular Primitives