1# TapGesture 2 3**TapGesture** is used to trigger a tap gesture with one, two, or more taps. 4 5> **NOTE** 6> 7> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. 8 9 10## APIs 11 12TapGesture(value?: { count?: number, fingers?: number }) 13 14**Atomic service API**: This API can be used in atomic services since API version 11. 15 16**Parameters** 17 18| Name| Type| Mandatory| Description| 19| -------- | -------- | -------- | -------- | 20| count | number | No| Number of consecutive taps. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>1. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.<br>2. If the distance between the last tapped position and the current tapped position exceeds 60 vp, gesture recognition fails.| 21| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value is used.<br>Default value: **1**<br>**NOTE**<br>1. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers pressing the screen within 300 ms of the first finger's being pressed is less than the required number, or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted is less than the required number.<br>2. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized.| 22 23 24## Events 25 26| Name| Description| 27| -------- | -------- | 28| onAction(event: (event: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Callback invoked when a tap gesture is recognized.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 29 30## Attributes 31 32| Name| Type |Description | 33| ---- | ------ | ---------------------------------------- | 34| tag<sup>11+</sup> | string | Tag for the tap gesture. It is used to distinguish the gesture during custom gesture judgment.| 35 36## Example 37 38```ts 39// xxx.ets 40@Entry 41@Component 42struct TapGestureExample { 43 @State value: string = '' 44 45 build() { 46 Column() { 47 // The gesture event is triggered by double-tapping. 48 Text('Click twice').fontSize(28) 49 .gesture( 50 TapGesture({ count: 2 }) 51 .onAction((event: GestureEvent) => { 52 if (event) { 53 this.value = JSON.stringify(event.fingerList[0]) 54 } 55 }) 56 ) 57 Text(this.value) 58 } 59 .height(200) 60 .width(300) 61 .padding(20) 62 .border({ width: 3 }) 63 .margin(30) 64 } 65} 66``` 67 68 69