1e41f4b71Sopenharmony_ci# Click Control
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciClick control attributes are used to set whether a component can respond to finger interactions such as click and touch events.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Attributes
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci| Name     | Type| Description                   |
14e41f4b71Sopenharmony_ci| ----------- | -------- | ------------------------ |
15e41f4b71Sopenharmony_ci| touchable<sup>(deprecated)</sup>   | boolean  | Whether the component can respond to finger interactions such as click and touch events.<br>Default value: **true**<br>**NOTE**<br>This API is deprecated since API version 9. You are advised to use [hitTestBehavior](ts-universal-attributes-hit-test-behavior.md) instead.|
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci## Example
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci```ts
21e41f4b71Sopenharmony_ci// xxx.ets
22e41f4b71Sopenharmony_ci@Entry
23e41f4b71Sopenharmony_ci@Component
24e41f4b71Sopenharmony_cistruct TouchAbleExample {
25e41f4b71Sopenharmony_ci  @State text1: string = ''
26e41f4b71Sopenharmony_ci  @State text2: string = ''
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci  build() {
29e41f4b71Sopenharmony_ci    Stack() {
30e41f4b71Sopenharmony_ci      Rect()
31e41f4b71Sopenharmony_ci        .fill(Color.Gray).width(150).height(150)
32e41f4b71Sopenharmony_ci        .onClick(() => {
33e41f4b71Sopenharmony_ci          console.info(this.text1 = 'Rect Clicked')
34e41f4b71Sopenharmony_ci        })
35e41f4b71Sopenharmony_ci        .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
36e41f4b71Sopenharmony_ci      Ellipse()
37e41f4b71Sopenharmony_ci        .fill(Color.Pink).width(150).height(80)
38e41f4b71Sopenharmony_ci        .touchable(false) // When the Ellipse area is touched, the message "Ellipse Clicked" is not displayed.
39e41f4b71Sopenharmony_ci        .onClick(() => {
40e41f4b71Sopenharmony_ci          console.info(this.text2 = 'Ellipse Clicked')
41e41f4b71Sopenharmony_ci        })
42e41f4b71Sopenharmony_ci        .overlay(this.text2, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
43e41f4b71Sopenharmony_ci    }.margin(100)
44e41f4b71Sopenharmony_ci  }
45e41f4b71Sopenharmony_ci}
46e41f4b71Sopenharmony_ci```
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci![en-us_image_0000001257138351](figures/en-us_image_0000001257138351.gif)
49