1# @ohos.app.form.formInfo (formInfo) 2 3The **formInfo** module provides types and enums related to the widget information and state. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import { formInfo } from '@kit.FormKit'; 13``` 14 15## formInfo.FormInfo 16 17Defines the widget information. 18 19**System capability**: SystemCapability.Ability.Form 20 21| Name | Type | Readable | Writable | Description | 22| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | 23| bundleName | string | Yes | No | Name of the bundle to which the widget belongs.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 24| moduleName | string | Yes | No | Name of the module to which the widget belongs.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 25| abilityName | string | Yes | No | Name of the ability to which the widget belongs.<br>**Atomic service API**: This API can be used in atomic services since API version 11. | 26| name | string | Yes | No | Name of an application or atomic service.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 27| displayName<sup>11+</sup> | string | Yes | No | Widget name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 28| displayNameId<sup>11+</sup> | number | Yes | No | ID of the widget name displayed during widget preview.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 29| description | string | Yes | No | Description of the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 30| descriptionId<sup>10+</sup> | number | Yes | No | ID of the widget description.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 31| type | [FormType](#forminfoformtype) | Yes | No | Type of the widget. Currently, JS and ArkTS widgets are supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 32| jsComponentName | string | Yes | No | Name of the component used in the JS widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 33| colorMode | [ColorMode](#forminfocolormode) | Yes | No | Color mode of the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 34| isDefault | boolean | Yes | No | Whether the widget is the default one.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 35| updateEnabled | boolean | Yes | No | Whether the widget is updatable.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 36| formVisibleNotify | boolean | Yes | No | Whether to send a notification when the widget is visible.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 37| scheduledUpdateTime | string | Yes | No | Time when the widget was updated.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 38| formConfigAbility | string | Yes | No | Configuration ability of the widget, that is, the ability corresponding to the option in the selection box displayed when the widget is long pressed.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 39| updateDuration | number | Yes | No | Update period of the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 40| defaultDimension | number | Yes | No | Widget specifications.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 41| supportDimensions | Array<number> | Yes | No | Dimensions supported by the widget. For details, see [FormDimension](#forminfoformdimension).<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 42| customizeData | Record\<string, string> | Yes | No | Custom data of the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 43| isDynamic<sup>10+</sup> | boolean | Yes | No | Whether the widget is a dynamic widget.<br>ArkTS widgets are classified into dynamic and static widgets. JS widgets are all dynamic widgets.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 44| transparencyEnabled<sup>11+</sup> | boolean | Yes | No | Whether the widget supports the setting of the background transparency.<br>For ArkTS widgets, the support for the background transparency setting depends on user configurations. For JS widgets, the background transparency setting is not supported.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 45| supportedShapes<sup>12+</sup> | Array<number> | Yes | No | Shapes supported by the widget. For details about the available shapes, see [FormShape<sup>12+</sup>](#forminfoformshape12).<br>**Atomic service API**: This API can be used in atomic services since API version 12. | 46| previewImages<sup>18+</sup> | Array<number> | Yes| No| Resource IDs of the preview images of the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 18. 47| enableBlurBackground<sup>18+</sup> | boolean | Yes | No | Whether the widget uses a blur background.<br>**Atomic service API**: This API can be used in atomic services since API version 18.| 48|renderingMode<sup>18+</sup>|[RenderingMode](#forminforenderingmode18)|Yes|No|Widget rendering mode.<br>**Atomic service API**: This API can be used in atomic services since API version 18.| 49 50## formInfo.FormType 51 52Enumerates the widget types. 53 54**Atomic service API**: This API can be used in atomic services since API version 11. 55 56**System capability**: SystemCapability.Ability.Form 57 58| Name | Value | Description | 59| ----------- | ---- | ------------ | 60| JS | 1 | JS widget. | 61| eTS | 2 | ArkTS widget.| 62 63## formInfo.ColorMode 64 65Enumerates the color modes supported by the widget. 66 67**Atomic service API**: This API can be used in atomic services since API version 11. 68 69**System capability**: SystemCapability.Ability.Form 70 71| Name | Value | Description | 72| ----------- | ---- | ------------ | 73| MODE_AUTO | -1 | Auto mode. | 74| MODE_DARK | 0 | Dark mode. | 75| MODE_LIGHT | 1 | Light mode. | 76 77## formInfo.FormStateInfo 78 79Describes the widget state information. 80 81**Atomic service API**: This API can be used in atomic services since API version 11. 82 83**System capability**: SystemCapability.Ability.Form 84 85| Name | Type | Readable | Writable | Description | 86| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | 87| formState | [FormState](#forminfoformstate) | Yes | No | Widget state. | 88| want | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | No | Want text. | 89 90## formInfo.FormState 91 92Enumerates the widget states. 93 94**Atomic service API**: This API can be used in atomic services since API version 11. 95 96**System capability**: SystemCapability.Ability.Form 97 98| Name | Value | Description | 99| ----------- | ---- | ------------ | 100| UNKNOWN | -1 | Unknown state. | 101| DEFAULT | 0 | Default state. | 102| READY | 1 | Ready state. | 103 104## formInfo.FormParam 105 106Enumerates the widget parameters. 107 108**System capability**: SystemCapability.Ability.Form 109 110| Name | Value | Description | 111| ----------- | ---- | ------------ | 112| IDENTITY_KEY | 'ohos.extra.param.key.form_identity' | Widget ID.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 113| DIMENSION_KEY | 'ohos.extra.param.key.form_dimension' | Widget dimension.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 114| NAME_KEY | 'ohos.extra.param.key.form_name' | Widget name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 115| MODULE_NAME_KEY | 'ohos.extra.param.key.module_name' | Name of the module to which the widget belongs.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 116| WIDTH_KEY | 'ohos.extra.param.key.form_width' | Widget width.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 117| HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 118| TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 119| ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 120| BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Bundle name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 121| LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 122| PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | Custom data.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 123| FORM_RENDERING_MODE_KEY<sup>11+</sup> | 'ohos.extra.param.key.form_rendering_mode' | Widget rendering mode.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 124| HOST_BG_INVERSE_COLOR_KEY<sup>12+</sup> | 'ohos.extra.param.key.host_bg_inverse_color' | Inverse background color of the widget client.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 125| FORM_LOCATION_KEY<sup>12+</sup> | 'ohos.extra.param.key.form_location' | Widget location.<br>OTHER -1 (other locations)<br>DESKTOP 0 (desktop)<br>FORM_CENTER 1 (widget center of the desktop)<br>FORM_MANAGER 2 (widget manager of the desktop)<br>NEGATIVE_SCREEN 3 (minus-one screen)<br>FORM_CENTER_NEGATIVE_SCREEN 4 (widget center of the minus-one screen)<br>FORM_MANAGER_NEGATIVE_SCREEN 5 (widget manager of the minus-one screen)<br>SCREEN_LOCK 6 (lock screen)<br>AI_SUGGESTION 7 (Celia suggestions area) 126| FORM_PERMISSION_NAME_KEY<sup>12+</sup> | 'ohos.extra.param.key.permission_name' | Name of the permission.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 127| FORM_PERMISSION_GRANTED_KEY<sup>12+</sup> | 'ohos.extra.param.key.permission_granted' | Whether the permission is granted.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 128 129## formInfo.FormDimension 130 131Enumerates the widget dimensions. 132 133**System capability**: SystemCapability.Ability.Form 134 135| Name | Value | Description | 136| ----------- | ---- | ------------ | 137| Dimension_1_2 | 1 | 1 x 2.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 138| Dimension_2_2 | 2 | 2 x 2.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 139| Dimension_2_4 | 3 | 2 x 4.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 140| Dimension_4_4 | 4 | 4 x 4.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 141| Dimension_2_1 | 5 | 2 x 1.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 142| DIMENSION_1_1<sup>11+<sup> | 6 | 1 x 1.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 143| DIMENSION_6_4<sup>12+<sup> | 7 | 6 x 4.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 144| DIMENSION_2_3<sup>18+<sup> | 8 | 2 x 3.<br>**Atomic service API**: This API can be used for wearable devices in atomic services since API version 18.| 145| DIMENSION_3_3<sup>18+<sup> | 9 | 3 x 3.<br>**Atomic service API**: This API can be used for wearable devices in atomic services since API version 18.| 146 147## formInfo.FormShape<sup>12+</sup> 148 149Enumerates the widget shapes. 150 151**System capability**: SystemCapability.Ability.Form 152 153| Name | Value | Description | 154| ----------- | ---- | ------------ | 155| RECT | 1 | Rectangle.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 156| CIRCLE | 2 | Circle.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 157 158## formInfo.FormInfoFilter 159 160Defines the widget information filter. Only the widget information that meets the filter is returned. 161 162**Atomic service API**: This API can be used in atomic services since API version 11. 163 164**System capability**: SystemCapability.Ability.Form 165 166| Name | Type | Mandatory |Description | 167| ----------- | ---- | ------------ |------------ | 168| moduleName | string |No | Only the information about the widget whose **moduleName** is the same as the provided value is returned.<br>If this parameter is not set, **moduleName** is not used for filtering. | 169 170 171 172## formInfo.VisibilityType 173 174Enumerates the visibility types of the widget. 175 176**Atomic service API**: This API can be used in atomic services since API version 11. 177 178**System capability**: SystemCapability.Ability.Form 179 180| Name | Value | Description | 181| ----------- | ---- | ------------ | 182| UNKNOWN<sup>10+</sup> | 0 | The visibility type of the widget is unknown.| 183| FORM_VISIBLE | 1 | The widget is visible.| 184| FORM_INVISIBLE | 2 | The widget is invisible.| 185 186 187## formInfo.LaunchReason<sup>10+</sup> 188 189Enumerates the reasons for creating a widget. 190 191**Atomic service API**: This API can be used in atomic services since API version 11. 192 193**System capability**: SystemCapability.Ability.Form 194 195| Name | Value | Description | 196| ----------- | ---- | ------------ | 197| FORM_DEFAULT | 1 | The widget is created by default.| 198| FORM_SHARE | 2 | The widget is created for sharing.| 199 200## formInfo.RenderingMode<sup>18+</sup> 201 202Enumerates the rendering modes supported by the widget. 203 204**Atomic service API**: This API can be used in atomic services since API version 18. 205 206**System capability**: SystemCapability.Ability.Form 207 208| Name | Value | Description | 209| ----------- | ---- | ------------ | 210| AUTO_COLOR | 0 | Auto mode. | 211| FULL_COLOR | 1 | Full-color mode. | 212| SINGLE_COLOR | 2 | Single-color mode. | 213