1# Enable/Disable
2
3The **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).
4
5>  **NOTE**
6>
7>  The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
8>
9>  The **enabled** attribute takes effect only when the component is pressed. It does not work when the component is interacting with the user.
10
11## enabled
12
13enabled(value: boolean)
14
15Sets whether the component responds to user interactions.
16
17**Widget capability**: Since API version 9, this feature is supported in ArkTS widgets.
18
19**Atomic service API**: This API can be used in atomic services since API version 11.
20
21**System capability**: SystemCapability.ArkUI.ArkUI.Full
22
23**Parameters**
24
25| Name| Type   | Mandatory| Description                                                        |
26| ------ | ------- | ---- | ------------------------------------------------------------ |
27| 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**|
28
29
30## Example
31
32This example demonstrates how to use **enable** to set whether a button responds to user interactions.
33
34```ts
35// xxx.ets
36@Entry
37@Component
38struct EnabledExample {
39
40  build() {
41    Flex({ justifyContent: FlexAlign.SpaceAround }) {
42      // The component does not respond to clicks.
43      Button('disable').enabled(false).backgroundColor(0x317aff).opacity(0.4)
44      Button('enable').backgroundColor(0x317aff)
45    }
46    .width('100%')
47    .padding({ top: 5 })
48  }
49}
50```
51
52![en-us_image_0000001212218428](figures/en-us_image_0000001212218428.gif)
53