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

DisableSelection

Common

Component in Compose Foundation

Disables text selection for its direct or indirect children. To use this, simply add this to wrap one or more text composables.

Last updated:

Installation

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

Overloads

@Composable
fun DisableSelection(content: @Composable () -> Unit)

Code Example

DisableSelectionSample

@Composable
fun DisableSelectionSample() {
    SelectionContainer {
        Column {
            Text("Text 1")

            DisableSelection {
                Text("Text 2")
                Text("טקסט 3")
            }

            Text("Text 3")
        }
    }
}
by @alexstyl