1e41f4b71Sopenharmony_ci# FormLink
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **FormLink** component is provided for interactions between static widgets and widget providers. It supports three types of events: router, message, and call.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> - This component is supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> - This component can be used only in static widgets.
10e41f4b71Sopenharmony_ci>
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## Required Permissions
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciNone
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## Child Components
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ciThis component supports only one child component.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci## APIs
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ciFormLink(options: FormLinkOptions)
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 10.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci**Parameters**
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci| Name      | Type                           | Mandatory  | Description  |
33e41f4b71Sopenharmony_ci| --------- | ------------------------------- | ---- | ------ |
34e41f4b71Sopenharmony_ci| options | [FormLinkOptions](#formlinkoptions) | Yes   | Widget information.|
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci## FormLinkOptions
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci| Name     | Type| Mandatory| Description                                                    |
43e41f4b71Sopenharmony_ci| ----------- | -------- | ---- | ------------------------------------------------------------ |
44e41f4b71Sopenharmony_ci| action      | string   | Yes  | Action type.<br>- **"router"**: redirection to the specified UIAbility of the widget provider.<br>- **"message"**: custom message. If this type of action is triggered, the [onFormEvent()](../../apis-form-kit/js-apis-app-form-formExtensionAbility.md#onformevent) lifecycle callback of the provider FormExtensionAbility is called.<br>- **"call"**: launch of the widget provider in the background. If this type of action is triggered, the specified UIAbility (whose launch type must be [singleton](../../../application-models/uiability-launch-type.md#singleton)) of the widget provider is started in the background, but not displayed in the foreground. This action type requires that the widget provider should have the [ohos.permission.KEEP_BACKGROUND_RUNNING](../../../security/AccessToken/permissions-for-all.md#ohospermissionkeep_background_running) permission.<br>**NOTE**<br>Whenever possible, avoid using the router event to refresh the widget UI.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 10.|
45e41f4b71Sopenharmony_ci| moduleName  | string   | No  | Name of the target module when action is **"router"** or **"call"**.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 10.|
46e41f4b71Sopenharmony_ci| bundleName  | string   | No  | Name of the target bundle when action is **"router"** or **"call"**.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 10.|
47e41f4b71Sopenharmony_ci| abilityName | string   | No  | Name of the target UIAbility when action is **"router"** or **"call"**.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 10.|
48e41f4b71Sopenharmony_ci| uri<sup>11+</sup> | string   | No  | URI of the target UIAbility when action is **"router"**. If both **uri** and **abilityName** are set, **abilityName** takes precedence.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 11.|
49e41f4b71Sopenharmony_ci| params      | Object   | No  | Additional parameters carried in the current action. The value is a key-value pair in JSON format. For the **"call"** action type, the **method** parameter must be set and its value type must be string.<br>**NOTE**<br>Whenever possible, avoid using **params** to transfer internal state variables of widgets.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 10.|
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci## Attributes
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciThe [universal attributes](ts-universal-attributes-size.md) are supported.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## Events
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported.
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci## Example
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci```ts
62e41f4b71Sopenharmony_ci@Entry
63e41f4b71Sopenharmony_ci@Component
64e41f4b71Sopenharmony_cistruct FormLinkDemo {
65e41f4b71Sopenharmony_ci  build() {
66e41f4b71Sopenharmony_ci    Column() {
67e41f4b71Sopenharmony_ci      Text("This is a static widget").fontSize(20).margin(10)
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci      // The router event is used to redirect to the specified UIAbility from the static widget.
70e41f4b71Sopenharmony_ci      FormLink({
71e41f4b71Sopenharmony_ci        action: "router",
72e41f4b71Sopenharmony_ci        abilityName: "EntryAbility",
73e41f4b71Sopenharmony_ci        params: {
74e41f4b71Sopenharmony_ci          'message': 'testForRouter' // Customize the message to send.
75e41f4b71Sopenharmony_ci        }
76e41f4b71Sopenharmony_ci      }) {
77e41f4b71Sopenharmony_ci        Button("router event").width(120)
78e41f4b71Sopenharmony_ci      }.margin(10)
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci      // The message event triggers the onFormEvent callback of FormExtensionAbility.
82e41f4b71Sopenharmony_ci      FormLink({
83e41f4b71Sopenharmony_ci        action: "message",
84e41f4b71Sopenharmony_ci        abilityName: "EntryAbility",
85e41f4b71Sopenharmony_ci        params: {
86e41f4b71Sopenharmony_ci          'message': 'messageEvent' // Customize the message to send.
87e41f4b71Sopenharmony_ci        }
88e41f4b71Sopenharmony_ci      }) {
89e41f4b71Sopenharmony_ci        Button("message event").width(120)
90e41f4b71Sopenharmony_ci      }.margin(10)
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci      // The call event is used to call the specified method in the UIAbility.
94e41f4b71Sopenharmony_ci      FormLink({
95e41f4b71Sopenharmony_ci        action: "call",
96e41f4b71Sopenharmony_ci        abilityName: "EntryAbility",
97e41f4b71Sopenharmony_ci        params: {
98e41f4b71Sopenharmony_ci          'method': 'funA', // Set the name of the method to call in the EntryAbility.
99e41f4b71Sopenharmony_ci          'num': 1 // Set other parameters to be passed in.
100e41f4b71Sopenharmony_ci        }
101e41f4b71Sopenharmony_ci      }) {
102e41f4b71Sopenharmony_ci        Button("call event").width(120)
103e41f4b71Sopenharmony_ci      }.margin(10)
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci      // The router event is used to redirect to the specified UIAbility from the static widget through deep linking.
106e41f4b71Sopenharmony_ci      FormLink({
107e41f4b71Sopenharmony_ci        action: "router",
108e41f4b71Sopenharmony_ci        uri: 'example://uri.ohos.com/link_page',
109e41f4b71Sopenharmony_ci        params: {
110e41f4b71Sopenharmony_ci          message:'router msg for static uri deeplink' // Customize the message to send.
111e41f4b71Sopenharmony_ci        }
112e41f4b71Sopenharmony_ci      }) {
113e41f4b71Sopenharmony_ci        Button("deeplink event").width(120)
114e41f4b71Sopenharmony_ci      }.margin(10)
115e41f4b71Sopenharmony_ci    }
116e41f4b71Sopenharmony_ci    .justifyContent(FlexAlign.Center)
117e41f4b71Sopenharmony_ci    .width('100%').height('100%')
118e41f4b71Sopenharmony_ci  }
119e41f4b71Sopenharmony_ci}
120e41f4b71Sopenharmony_ci```
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci![FormLink](figures/formLink.png)
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ciThe following is an example of **uris** configuration in the [module.json5](../../../quick-start/module-configuration-file.md#skills) file of the target application:
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci```json
127e41f4b71Sopenharmony_ci"abilities": [
128e41f4b71Sopenharmony_ci  {
129e41f4b71Sopenharmony_ci    "skills": [
130e41f4b71Sopenharmony_ci      {
131e41f4b71Sopenharmony_ci        "uris": [
132e41f4b71Sopenharmony_ci          {
133e41f4b71Sopenharmony_ci            "scheme": "example",
134e41f4b71Sopenharmony_ci            "host": "uri.ohos.com",
135e41f4b71Sopenharmony_ci            "path": "link_page"
136e41f4b71Sopenharmony_ci          },
137e41f4b71Sopenharmony_ci        ]
138e41f4b71Sopenharmony_ci      }
139e41f4b71Sopenharmony_ci    ],
140e41f4b71Sopenharmony_ci  }
141e41f4b71Sopenharmony_ci]
142e41f4b71Sopenharmony_ci```
143