# LinkAnnotation.Clickable

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/LinkAnnotation.kt+class:androidx.compose.ui.text.LinkAnnotation.Clickable) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0) Common/AllAndroid/JVM
- Cmn

  ```
  class LinkAnnotation.Clickable : LinkAnnotation
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.compose.ui.text.LinkAnnotation](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation) ||
|   | ↳ | [androidx.compose.ui.text.LinkAnnotation.Clickable](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable) |

*** ** * ** ***

An annotation that contains a clickable marked with `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#tag()`. When clicking on the text to which this annotation is attached, the app will trigger a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#linkInteractionListener()` listener.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation` |   |

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#Clickable(kotlin.String,androidx.compose.ui.text.TextLinkStyles,androidx.compose.ui.text.LinkInteractionListener)( tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, styles: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLinkStyles?, linkInteractionListener: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkInteractionListener? )` | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#copy(kotlin.String,androidx.compose.ui.text.TextLinkStyles,androidx.compose.ui.text.LinkInteractionListener)( tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, styles: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLinkStyles?, linkInteractionListener: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkInteractionListener? )` Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable`, optionally overriding some of the values. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#hashCode()()` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkInteractionListener?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#linkInteractionListener()` Interaction listener triggered when user interacts with this link. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLinkStyles?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#styles()` Style configuration for this link in different states. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable#tag()` | Cmn |

## Public constructors

### Clickable

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
Clickable(
    tag: String,
    styles: TextLinkStyles? = null,
    linkInteractionListener: LinkInteractionListener?
)
```

## Public functions

### copy

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun copy(
    tag: String = this.tag,
    styles: TextLinkStyles? = this.styles,
    linkInteractionListener: LinkInteractionListener? = this.linkInteractionListener
): LinkAnnotation.Clickable
```

Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/LinkAnnotation.Clickable`, optionally overriding some of the values.

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### linkInteractionListener

Cmn

```
open val linkInteractionListener: LinkInteractionListener?
```

Interaction listener triggered when user interacts with this link.

```kotlin
import androidx.compose.foundation.text.BasicText
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withLink
import androidx.compose.ui.unit.sp

// Display a link in the text and log metrics whenever user clicks on it. In that case we handle
// the link using openUri method of the LocalUriHandler
val uriHandler = LocalUriHandler.current
BasicText(
    buildAnnotatedString {
        append("Build better apps faster with ")
        val link =
            LinkAnnotation.Url(
                "https://developer.android.com/jetpack/compose",
                TextLinkStyles(SpanStyle(color = Color.Blue)),
            ) {
                val url = (it as LinkAnnotation.Url).url
                // log some metrics
                uriHandler.openUri(url)
            }
        withLink(link) { append("Jetpack Compose") }
    }
)
```

### styles

Cmn

```
open val styles: TextLinkStyles?
```

Style configuration for this link in different states.

```kotlin
import androidx.compose.foundation.text.BasicText
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.withLink
import androidx.compose.ui.unit.sp

// Display a link in the text that gets an underline when hovered
BasicText(
    buildAnnotatedString {
        append("Build better apps faster with ")
        val link =
            LinkAnnotation.Url(
                "https://developer.android.com/jetpack/compose",
                TextLinkStyles(
                    style = SpanStyle(color = Color.Blue),
                    hoveredStyle = SpanStyle(textDecoration = TextDecoration.Underline),
                ),
            )
        withLink(link) { append("Jetpack Compose") }
    }
)
```

### tag

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0)

```
val tag: String
```