Text Component Common APIs (System API)
This topic covers the common APIs of text components.
NOTE
The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
This topic describes only the system APIs provided by the module. For details about its public APIs, see Basic Types and Text Component Common APIs.
TextContentControllerBase
Represents the base controller for TextInput, TextArea, and Search components.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
getText19+
getText(range?: TextRange): string
Obtains the text content within a specified range.
Atomic service API: This API can be used in atomic services since API version 19.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| range | TextRange | No | Range of the text content to obtain, defined by start and end positions. If the range is not specified, the entire text is obtained by default. If the start position is not specified, it defaults to index 0. If the end position is not specified, it defaults to the end of the text. |
Return value
| Type | Description |
|---|---|
| string | Text content within the specified range. |
KeyboardGradientMode20+
Enumerates keyboard gradient effects.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Value | Description |
|---|---|---|
| NONE | 0 | No gradient effect. |
| LINEAR_GRADIENT | 1 | Linear gradient effect. |
KeyboardFluidLightMode20+
Enumerates keyboard fluid lighting effects.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Value | Description |
|---|---|---|
| NONE | 0 | No fluid lighting effect. |
| BACKGROUND_FLUID_LIGHT | 1 | Background fluid lighting effect enabled. |
KeyboardAppearanceConfig20+
Describes the keyboard visual style configuration.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| gradientMode | KeyboardGradientMode | No | Yes | Keyboard gradient effect. Default value: KeyboardGradientMode.NONE |
| fluidLightMode | KeyboardFluidLightMode | No | Yes | Keyboard fluid lighting effect. Default value: KeyboardFluidLightMode.NONE |
TextChangeReason20+
Enumerates the reasons for component content changes.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Value | Description |
|---|---|---|
| UNKNOWN | 0 | Unknown reason. |
| INPUT | 1 | User input. |
| PASTE | 2 | Paste operation. |
| CUT | 3 | Cut operation. |
| DRAG | 4 | Drag and drop operation. |
| AUTO_FILL | 5 | Auto-fill operation. |
| AI_WRITE | 6 | AI-assisted writing. |
| REDO | 7 | Redo operation. |
| UNDO | 8 | Undo operation. |
| CONTROLLER | 9 | Component API call. |
| ACCESSIBILITY | 10 | Accessibility API. |
| COLLABORATION | 11 | Cross-device photographing. |
| STYLUS | 12 | Stylus input. |
VoiceButtonOptions23+
Sets the voice button options.
Atomic service API: This API can be used in atomic services since API version 23.
System API: This is a system API.
System capability: SystemCapability.ArkUI.ArkUI.Full
Model restriction: This API can be used only in the stage model.
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| enabled | boolean | No | Yes | Whether to enable or disable the voice button for the input box. true: The voice button is enabled. false: The voice button is disabled. Default value: false |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 ts-drawing-components-shape
openharmony 鸿蒙 ts-universal-attributes-sharp-clipping
openharmony 鸿蒙 ts-universal-attributes-toolbar
openharmony 鸿蒙 ts-container-lazyvgridlayout
openharmony 鸿蒙 ohos-arkui-advanced-FoldSplitContainer
openharmony 鸿蒙 ts-methods-calendarpicker-dialog
openharmony 鸿蒙 ts-uicommonevent
openharmony 鸿蒙 ts-basic-gestures-tapgesture