'make each word clickable in jetpack compose

ClickableText will return position of clicked character but is it possible to make each word clickable and return it?

@Composable
fun SimpleClickableText() {
    ClickableText(
        text = AnnotatedString("Click Me"),
        onClick = { offset ->
            Log.d("ClickableText", "$offset -th character is clicked.")
        }
    )
}

for example I have this string -> "This is a sample text" and I want to click word "sample" and return it as string



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source