link

fun link(tag: String = "", onClick: () -> Unit): LinkAnnotation

Creates a clickable LinkAnnotation.

Use this in combination with lidl.brand.ods.core.text.Text to create styled, individually clickable links:

val linkAnnotation = link {
println("This link was clicked!")
}

val text = buildAnnotatedString {
append("Hello ")

withLink(linkAnnotation) {
append("World")
}

append("!")
}

Text(
text = text,
baseTypography = OdsTheme.typographies.mobile.body.normal,
color = OdsTheme.color.text.bg.primary,
)

Link Sample

Return

A styled LinkAnnotation.Clickable instance.

Parameters

tag

The tag for the link. Defaults to an empty string.

onClick

The action to perform when the link is clicked.


fun link(url: String, linkInteractionListener: LinkInteractionListener? = null): LinkAnnotation.Url

Creates a URL LinkAnnotation.

Use this in combination with lidl.brand.ods.core.text.Text to create styled, individually clickable links:

val linkAnnotation = link(url = "https://www.lidl.com")

val text = buildAnnotatedString {
append("Hello ")

withLink(linkAnnotation) {
append("World")
}

append("!")
}

Text(
text = text,
baseTypography = OdsTheme.typographies.mobile.body.normal,
color = OdsTheme.color.text.bg.primary,
)

Link Sample

Return

A styled LinkAnnotation.Url instance.

Parameters

url

The URL to open when the link is clicked.

linkInteractionListener

The listener to be notified when the link is interacted with.