1# Class (WebKeyboardController) 2 3Implements a controller to control the input, deletion, and closure of the custom keyboard. For details about the sample code, see [onInterceptKeyboardAttach](./arkts-basic-components-web-events.md#oninterceptkeyboardattach12). 4 5> **NOTE** 6> 7> - The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 8> 9> - The initial APIs of this class are supported since API version 12. 10> 11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer. 12 13## constructor<sup>12+</sup> 14 15constructor() 16 17Constructs a **WebKeyboardController** API. 18 19**System capability**: SystemCapability.Web.Webview.Core 20 21## insertText<sup>12+</sup> 22 23insertText(text: string): void 24 25Inserts characters into the **Web** component text box. 26 27**System capability**: SystemCapability.Web.Webview.Core 28 29**Parameters** 30 31| Name| Type| Mandatory| Description| 32| ------ | -------- | ---- | --------------------- | 33| text | string | Yes| Characters to insert into the **Web** component text box.| 34 35## deleteForward<sup>12+</sup> 36 37deleteForward(length: number): void 38 39Deletes a specified number of characters forward in a **Web** component text box. 40 41**System capability**: SystemCapability.Web.Webview.Core 42 43**Parameters** 44 45| Name| Type| Mandatory| Description | 46| ------ | -------- | ---- | ------------------------ | 47| length | number | Yes | Length of characters to delete forward in a **Web** component text box.<br>The parameter has no value range. If the parameter value is greater than the character length, all characters before the cursor are deleted by default. If the parameter value is a negative number, the deletion is not performed.| 48 49## deleteBackward12+</sup> 50 51deleteBackward(length: number): void 52 53Deletes a specified number of characters backward in a **Web** component text box. 54 55**System capability**: SystemCapability.Web.Webview.Core 56 57**Parameters** 58 59| Name| Type| Mandatory| Description | 60| ------ | -------- | ---- | ------------------------ | 61| length | number | Yes | Length of characters to delete backward in a **Web** component text box.<br>The parameter has no value range. If the parameter value is greater than the character length, all characters after the cursor are deleted by default. If the parameter value is a negative number, the deletion is not performed.| 62 63## sendFunctionKey<sup>12+</sup> 64 65sendFunctionKey(key: number): void 66 67Inserts a function key. Currently, only the Enter key type is supported. For details about the value, see [EnterKeyType](../apis-ime-kit/js-apis-inputmethod.md#enterkeytype10). 68 69**System capability**: SystemCapability.Web.Webview.Core 70 71**Parameters** 72 73| Name| Type| Mandatory| Description | 74| ------ | -------- | ---- | ------------------------------------------ | 75| key | number | Yes | Function key to insert into the **Web** component text box. Currently, only the Enter key is supported.| 76 77## close<sup>12+</sup> 78 79close(): void 80 81Closes this custom keyboard. 82 83**System capability**: SystemCapability.Web.Webview.Core 84