1e41f4b71Sopenharmony_ci# Configuring Widget Configuration Files 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciWidget-related configuration includes **FormExtensionAbility** configuration and widget configuration. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci1. Configure FormExtensionAbility information under **extensionAbilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For a FormExtensionAbility, you must specify **metadata**. Specifically, set **name** to **ohos.extension.form** (fixed), and set **resource** to the index of the widget configuration information. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci Example configuration: 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci ```json 13e41f4b71Sopenharmony_ci { 14e41f4b71Sopenharmony_ci "module": { 15e41f4b71Sopenharmony_ci ... 16e41f4b71Sopenharmony_ci "extensionAbilities": [ 17e41f4b71Sopenharmony_ci { 18e41f4b71Sopenharmony_ci "name": "EntryFormAbility", 19e41f4b71Sopenharmony_ci "srcEntry": "./ets/entryformability/EntryFormAbility.ets", 20e41f4b71Sopenharmony_ci "label": "$string:EntryFormAbility_label", 21e41f4b71Sopenharmony_ci "description": "$string:EntryFormAbility_desc", 22e41f4b71Sopenharmony_ci "type": "form", 23e41f4b71Sopenharmony_ci "metadata": [ 24e41f4b71Sopenharmony_ci { 25e41f4b71Sopenharmony_ci "name": "ohos.extension.form", 26e41f4b71Sopenharmony_ci "resource": "$profile:form_config" 27e41f4b71Sopenharmony_ci } 28e41f4b71Sopenharmony_ci ] 29e41f4b71Sopenharmony_ci } 30e41f4b71Sopenharmony_ci ] 31e41f4b71Sopenharmony_ci } 32e41f4b71Sopenharmony_ci } 33e41f4b71Sopenharmony_ci ``` 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci2. Configure the widget configuration information. In the **metadata** configuration item of FormExtensionAbility, you can specify the resource index of specific configuration information of the widget. For example, if **resource** is set to **$profile:form_config**, **form_config.json** in the **resources/base/profile/** directory of the development view is used as the profile configuration file of the widget. The following table describes the internal structure of the profile configuration file. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci **Table 1** form_config.json file 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci | Field | Description | Data Type | Default Value Allowed | 40e41f4b71Sopenharmony_ci | -------- | -------- | -------- | -------- | 41e41f4b71Sopenharmony_ci | name | Name of the widget. The value is a string with a maximum of 127 bytes. | String | No | 42e41f4b71Sopenharmony_ci | displayName | Display name of the widget. The value can be a string or a resource index to the name in multiple languages. The string must contain 1 to 30 bytes. | String | Yes | 43e41f4b71Sopenharmony_ci | description | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes. | String | Yes (initial value: left empty) | 44e41f4b71Sopenharmony_ci | src | Full path of the UI code corresponding to the widget. For an ArkTS widget, the full path must contain the widget file name extension, for example, **./ets/widget/pages/WidgetCard.ets**. For a JS widget, the full path does not need to contain the widget file name extension, for example, **./js/widget/pages/WidgetCard**. | String | No | 45e41f4b71Sopenharmony_ci | uiSyntax | Type of the widget.<br>- **arkts**: ArkTS widget<br>- **hml**: JS widget | String | Yes (initial value: **hml**) | 46e41f4b71Sopenharmony_ci | window | Window-related configurations. | Object | Yes (initial value: see Table 2) | 47e41f4b71Sopenharmony_ci | isDefault | Whether the widget is a default one. Each UIAbility has only one default widget.<br>- **true**: The widget is the default one.<br>- **false**: The widget is not the default one. | Boolean | No | 48e41f4b71Sopenharmony_ci | colorMode | Color mode of the widget.<br>- **auto**: following the system color mode<br>- **dark**: dark color mode<br>- **light**: light color mode | String | Yes (initial value: **auto**) | 49e41f4b71Sopenharmony_ci | supportDimensions | Grid styles supported by the widget.<br>- **1 * 2**: indicates a grid with one row and two columns.<br>- **2 * 2**: indicates a grid with two rows and two columns.<br>- **2 * 4**: indicates a grid with two rows and four columns.<br>- **4 * 4**: indicates a grid with four rows and four columns.<br>- **1 * 1**: indicates a round widget with one row and one column.<br>- **6 * 4**: indicates a grid with six rows and four columns. | String array | No | 50e41f4b71Sopenharmony_ci | defaultDimension | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget. | String | No | 51e41f4b71Sopenharmony_ci | updateEnabled | Whether the widget can be updated periodically.<br>- **true**: The widget can be updated at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used.<br>- **false**: The widget cannot be updated periodically. | Boolean | No | 52e41f4b71Sopenharmony_ci | scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute.<br>**NOTE**<br>**updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used. | String | Yes (initial value: The widget is not updated at the scheduled time.) | 53e41f4b71Sopenharmony_ci | updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.<br>If the value is **0**, this field does not take effect.<br>If the value is a positive integer *N*, the interval is calculated by multiplying *N* and 30 minutes.<br>**NOTE**<br>**updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used. | Number | Yes (initial value: **0**) | 54e41f4b71Sopenharmony_ci | formConfigAbility | Link to a specific page of the application. The value is a URI.| String | Yes (initial value: left empty) | 55e41f4b71Sopenharmony_ci | metadata | Metadata of the widget. For details, see [Metadata](../reference/apis-ability-kit/js-apis-bundleManager-metadata.md). | Object | Yes (initial value: left empty) | 56e41f4b71Sopenharmony_ci | dataProxyEnabled | Whether the widget supports the update-through-proxy feature.<br>- **true**: The widget supports the update-through-proxy feature.<br>- **false**: The widget does not support the update-through-proxy feature.<br>If this tag is set to **true**, [the settings for the scheduled update time will still take effect, but the settings for the update interval and next update time will not](./arkts-ui-widget-update-by-time.md). | Boolean | Yes (initial value: **false**) | 57e41f4b71Sopenharmony_ci | isDynamic | Whether the widget is a dynamic widget. This tag applies only to ArkTS widgets.<br>- **true**: The widget is a dynamic widget.<br>- **false**: The widget is a static widget.<br>| Boolean | Yes (initial value: **true**) | 58e41f4b71Sopenharmony_ci | formVisibleNotify | Whether the widget is allowed to use the widget visibility notification. This parameter is valid only for widgets of system applications. | Boolean | Yes (initial value: **false**) | 59e41f4b71Sopenharmony_ci | transparencyEnabled | Whether the widget host is allowed to set the background transparency of the widget. This tag applies only to ArkTS widgets. <br>- **true**: The widget host is allowed to set the background transparency of the widget.<br>- **false**: The widget host is not allowed to set the background transparency of the widget.<br>| Boolean | Yes (initial value: **false**) | 60e41f4b71Sopenharmony_ci | fontScaleFollowSystem | Whether the font size of the widget changes with the system font size.<br>- **true**: The font size varies with the system font size.<br>- **false**: The font size cannot change with the system font size.<br>| Boolean | Yes (initial value: **true**) | 61e41f4b71Sopenharmony_ci | supportShapes | Shapes that the widget can be displayed. The options are as follows:<br>- **rect**: square widget.<br>- **circle**: circular widget.| String | Yes (initial value: **rect**) | 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci **Table 2** Internal structure of the window object 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci | Field | Description | Data Type | Default Value Allowed | 66e41f4b71Sopenharmony_ci | -------- | -------- | -------- | -------- | 67e41f4b71Sopenharmony_ci | designWidth | Baseline width for page design. The size of an element is scaled by the actual device width. | Number | Yes (initial value: **720px**) | 68e41f4b71Sopenharmony_ci | autoDesignWidth | Whether to automatically calculate the baseline width for page design. If it is set to **true**, the **designWidth** attribute will be ignored, and the baseline width will be calculated based on the device width and screen density. | Boolean | Yes (initial value: **false**) | 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci Example configuration: 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci ```json 74e41f4b71Sopenharmony_ci { 75e41f4b71Sopenharmony_ci "forms": [ 76e41f4b71Sopenharmony_ci { 77e41f4b71Sopenharmony_ci "name": "widget", 78e41f4b71Sopenharmony_ci "displayName": "$string:widget_display_name", 79e41f4b71Sopenharmony_ci "description": "$string:widget_desc", 80e41f4b71Sopenharmony_ci "src": "./ets/widget/pages/WidgetCard.ets", 81e41f4b71Sopenharmony_ci "uiSyntax": "arkts", 82e41f4b71Sopenharmony_ci "window": { 83e41f4b71Sopenharmony_ci "designWidth": 720, 84e41f4b71Sopenharmony_ci "autoDesignWidth": true 85e41f4b71Sopenharmony_ci }, 86e41f4b71Sopenharmony_ci "colorMode": "auto", 87e41f4b71Sopenharmony_ci "isDefault": true, 88e41f4b71Sopenharmony_ci "updateEnabled": true, 89e41f4b71Sopenharmony_ci "scheduledUpdateTime": "10:30", 90e41f4b71Sopenharmony_ci "updateDuration": 1, 91e41f4b71Sopenharmony_ci "defaultDimension": "2*2", 92e41f4b71Sopenharmony_ci "supportDimensions": [ 93e41f4b71Sopenharmony_ci "2*2" 94e41f4b71Sopenharmony_ci ], 95e41f4b71Sopenharmony_ci "formConfigAbility": "ability://EntryAbility", 96e41f4b71Sopenharmony_ci "dataProxyEnabled": false, 97e41f4b71Sopenharmony_ci "isDynamic": true, 98e41f4b71Sopenharmony_ci "transparencyEnabled": false, 99e41f4b71Sopenharmony_ci "metadata": [] 100e41f4b71Sopenharmony_ci } 101e41f4b71Sopenharmony_ci ] 102e41f4b71Sopenharmony_ci } 103e41f4b71Sopenharmony_ci ``` 104