1e41f4b71Sopenharmony_ci# Enable/Disable
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **enabled** attribute sets whether a component responds to user interactions, such as [click events](ts-universal-events-click.md), [touch events](ts-universal-events-touch.md), [drag events](ts-universal-events-drag-drop.md), [key events](ts-universal-events-key.md), [focus events](ts-universal-focus-event.md), and [mouse events](ts-universal-mouse-key.md).
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>  The **enabled** attribute takes effect only when the component is pressed. It does not work when the component is interacting with the user.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## enabled
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_cienabled(value: boolean)
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciSets whether the component responds to user interactions.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Widget capability**: Since API version 9, this feature is supported in ArkTS widgets.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**Parameters**
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci| Name| Type   | Mandatory| Description                                                        |
26e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
27e41f4b71Sopenharmony_ci| value  | boolean | Yes  | Whether the component responds to user interactions, including clicks and touches. The value **true** means that the component responds to user interactions, and **false** means the opposite.<br>Default value: **true**|
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci## Example
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci```ts
33e41f4b71Sopenharmony_ci// xxx.ets
34e41f4b71Sopenharmony_ci@Entry
35e41f4b71Sopenharmony_ci@Component
36e41f4b71Sopenharmony_cistruct EnabledExample {
37e41f4b71Sopenharmony_ci  
38e41f4b71Sopenharmony_ci  build() {
39e41f4b71Sopenharmony_ci    Flex({ justifyContent: FlexAlign.SpaceAround }) {
40e41f4b71Sopenharmony_ci      // The component does not respond to clicks.
41e41f4b71Sopenharmony_ci      Button('disable').enabled(false).backgroundColor(0x317aff).opacity(0.4)
42e41f4b71Sopenharmony_ci      Button('enable').backgroundColor(0x317aff)
43e41f4b71Sopenharmony_ci    }
44e41f4b71Sopenharmony_ci    .width('100%')
45e41f4b71Sopenharmony_ci    .padding({ top: 5 })
46e41f4b71Sopenharmony_ci  }
47e41f4b71Sopenharmony_ci}
48e41f4b71Sopenharmony_ci```
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci![en-us_image_0000001212218428](figures/en-us_image_0000001212218428.gif)
51