🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

SelectionState

Selection state object for a particular SelectionContainer.

SelectionStateSample

@Sampled
@Composable
fun SelectionStateSample() {
    val selectionState = rememberSelectionState()

    val characterCount = selectionState.selectedTexts.sumOf { it.text.length }

    Column {
        SelectionContainer(state = selectionState) {
            Column { BasicText(text = "Text to be selected...") }
        }
        if (characterCount > 0) {
            BasicText(text = "Characters selected: $characterCount")
        }
    }
}

Content updated: