Skip to content

firefinchdev/linkify-text

Repository files navigation

LinkifyText for Compose

Same as Text() composable, but with clickable link support. When a link is clicked, appropiate intent is fired (Eg: Browsing for Website, Open mail app for emails, etc)

Uses Linkify for link detection, which is same as that of TextView's autoLink.

Usage

Copy LinkifyText.kt in your project.

LinkifyText(
    text = text,                        // Text with websites, phone, emails and/or maps
    linkColor = Color.Blue,             // Color of the link
    linkEntire = false,                 // Skip link detection, and link entire text
    clickable = true,                   // false for view-only links
    onClickLink = { clickedLink ->  },  // Optional callback when a link is clicked
    color = Color.Black,                // Non-linked text color

    // Other standard options available on Text Composable
    modifier = ..
    fontSize = ..
    fontStyle = ..
    fontWeight = ..
    fontFamily = ..
    letterSpacing = ..
    textDecoration = ..
    textAlign = ..
    lineHeight = ..
    overflow = ..
    softWrap = ..
    maxLines = ..
    onTextLayout = ..
    style = ..
)

Sample

License

MIT, see LICENSE.txt.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages