The Hyperlink component implements a link from a location in the component to another location.
If 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.
Hyperlink(address: string | Resource, content?: string | Resource)
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
color(value: Color | number | string | Resource)
Sets the color of the hyperlink text.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
@Entry
@Component
struct HyperlinkExample {
build() {
Column() {
Column() {
Hyperlink('https://example.com/') {
Image($r('app.media.bg'))
.width(200)
.height(100)
}
}
Column() {
Hyperlink('https://example.com/', 'Go to the developer website') {
}
.color(Color.Blue)
}
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
} 