1e41f4b71Sopenharmony_ci# Cursor Control 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciCursor control attributes control how the cursor is displayed when the mouse pointer is placed over an element. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> This feature is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci## cursorControl 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci### setCursor 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_cisetCursor(value: PointerStyle): void 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ciSets the cursor style. This API is a global API. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci**Parameters** 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 21e41f4b71Sopenharmony_ci| ----- | ------ | ---- | ---- | 22e41f4b71Sopenharmony_ci| value | [PointerStyle](../apis/js-apis-pointer.md#pointerstyle) | All consistent | Cursor style.| 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci### restoreDefault 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_cirestoreDefault(): void 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciRestores the cursor to its default style. This API is a global API. 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci## Example 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci```ts 36e41f4b71Sopenharmony_ci// xxx.ets 37e41f4b71Sopenharmony_ciimport pointer from '@ohos.multimodalInput.pointer'; 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci@Entry 40e41f4b71Sopenharmony_ci@Component 41e41f4b71Sopenharmony_cistruct CursorControlExample { 42e41f4b71Sopenharmony_ci @State text: string = '' 43e41f4b71Sopenharmony_ci controller: TextInputController = new TextInputController() 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci build() { 46e41f4b71Sopenharmony_ci Column() { 47e41f4b71Sopenharmony_ci Row().height(200).width(200).backgroundColor(Color.Green).position({x: 150 ,y:70}) 48e41f4b71Sopenharmony_ci .onHover((flag) => { 49e41f4b71Sopenharmony_ci if (flag) { 50e41f4b71Sopenharmony_ci cursorControl.setCursor(pointer.PointerStyle.EAST) 51e41f4b71Sopenharmony_ci } else { 52e41f4b71Sopenharmony_ci cursorControl.restoreDefault() 53e41f4b71Sopenharmony_ci } 54e41f4b71Sopenharmony_ci }) 55e41f4b71Sopenharmony_ci Row().height(200).width(200).backgroundColor(Color.Blue).position({x: 220 ,y:120}) 56e41f4b71Sopenharmony_ci .onHover((flag) => { 57e41f4b71Sopenharmony_ci if (flag) { 58e41f4b71Sopenharmony_ci cursorControl.setCursor(pointer.PointerStyle.WEST) 59e41f4b71Sopenharmony_ci } else { 60e41f4b71Sopenharmony_ci cursorControl.restoreDefault() 61e41f4b71Sopenharmony_ci } 62e41f4b71Sopenharmony_ci }) 63e41f4b71Sopenharmony_ci }.width('100%') 64e41f4b71Sopenharmony_ci } 65e41f4b71Sopenharmony_ci} 66e41f4b71Sopenharmony_ci``` 67e41f4b71Sopenharmony_ciDiagram: 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ciWhen the mouse pointer is placed over the blue area, the west arrow cursor is displayed. 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ciWhen the mouse pointer is placed over the green area, the east arrow cursor is displayed. 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci 76