Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.53 KB

README.md

File metadata and controls

44 lines (35 loc) · 1.53 KB

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.