annotationClickDetector

fun Modifier.annotationClickDetector(textLayoutResult: TextLayoutResult?, activeTags: Set<String>, activePointerIcon: PointerIcon = PointerIcon.Hand, onClick: (Int, List<AnnotatedString.Range<String>>) -> Unit): Modifier

Detects annotations tagged by a specific tag in the annotated text, which is shown in the component. If a mouse pointer hovers over such text, its icon is changed and if clicked, the onClick handler will be called.

Parameters

textLayoutResult

Layout result of the text-displaying component in which annotations should be detected.

activeTags

Set of tags, which are considered active. Only active tags are detected.

activePointerIcon

What should a pointer hovering above the active annotation look like. Defaults to PointerIcon.Hand.

onClick

Handler to be called when an active annotation is clicked. Receives the text offset where the click happened and a list of annotations on that offset.