Compose Unstyled 2.0 is out! Check the official announcement blog ->
Composable Function

SelectionContainer

Enables text selection for its direct or indirect children.

SelectAllSample

@Composable
fun SelectAllSample() {
    val selectionState = rememberSelectionState()
    Column {
        Button(onClick = { selectionState.selectAll() }) { BasicText("Select All") }
        SelectionContainer(state = selectionState) { BasicText(text = "Text to be selected...") }
    }
}

SelectionSample

@Composable
fun SelectionSample() {
    SelectionContainer {
        Column {
            Text("Text 1")
            Text("Text 2")
            Text("טקסט 3")
        }
    }
}

Last updated: