---
title: "LinkAnnotation"
description: "An annotation that represents a clickable part of the text."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
abstract class LinkAnnotation private constructor() : AnnotatedString.Annotation
```


An annotation that represents a clickable part of the text.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
abstract val linkInteractionListener: LinkInteractionListener?
```


Interaction listener triggered when user interacts with this link.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
abstract val styles: TextLinkStyles?
```


Style configuration for this link in different states.




## Code Examples

### AnnotatedStringWithLinkSample
```kotlin
@Composable
fun AnnotatedStringWithLinkSample() {
    // Display a link in the text
    BasicText(
        buildAnnotatedString {
            append("Build better apps faster with ")
            withLink(
                LinkAnnotation.Url(
                    "https://developer.android.com/jetpack/compose",
                    TextLinkStyles(style = SpanStyle(color = Color.Blue)),
                )
            ) {
                append("Jetpack Compose")
            }
        }
    )
}
```

