• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Hyperlink
2
3The **\<Hyperlink>** component implements a link from a location in the component to another location.
4
5>  **NOTE**
6>
7>  - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
8>  - This component must be used with the system browser.
9
10## Required Permissions
11
12If Internet access is required, you need to apply for the **ohos.permission.INTERNET** permission. For details about how to apply for a permission, see [Declaring Permissions](../../security/accesstoken-guidelines.md).
13
14## Child Components
15
16Supported
17
18
19## APIs
20
21Hyperlink(address: string | Resource, content?: string | Resource)
22
23Since API version 9, this API is supported in ArkTS widgets.
24
25**Parameters**
26
27| Name| Type| Mandatory| Description|
28| -------- | -------- | -------- | -------- |
29| address | string \| [Resource](ts-types.md#resource) | Yes| Web page to which the hyperlink is redirected.|
30| content | string \| [Resource](ts-types.md#resource) | No| Text displayed in the hyperlink.<br>**NOTE**<br>If this component has child components, the hyperlink text is not displayed.|
31
32## Attributes
33
34Only the following attributes are supported.
35
36| Name| Type| Description|
37| -------- | -------- | -------- |
38| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the hyperlink text.|
39
40## Example
41
42```ts
43@Entry
44@Component
45struct HyperlinkExample {
46  build() {
47    Column() {
48      Column() {
49        Hyperlink('https://example.com/') {
50          Image($r('app.media.bg'))
51            .width(200)
52            .height(100)
53        }
54      }
55
56      Column() {
57        Hyperlink('https://example.com/', 'Go to the developer website') {
58        }
59        .color(Color.Blue)
60      }
61    }.width('100%').height('100%').justifyContent(FlexAlign.Center)
62  }
63}
64```
65
66![hyperlink](figures/hyperlink.PNG)
67