We just launched Compose Examples featuring over 150+ components! Check it out →

SelectionContainer

Common

Component in Compose Foundation

Enables text selection for its direct or indirect children.

Use of a lazy layout, such as [LazyRow][androidx.compose.foundation.lazy.LazyRow] or [LazyColumn][androidx.compose.foundation.lazy.LazyColumn], within a [SelectionContainer] has undefined behavior on text items that aren't composed. For example, texts that aren't composed will not be included in copy operations and select all will not expand the selection to include them.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.8.0-alpha04")
}

Overloads

@Composable
fun SelectionContainer(modifier: Modifier = Modifier, content: @Composable () -> Unit)

Code Example

SelectionSample

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