Is there a way to disable all interaction for Jetpack Compose's TextField?
You can use the enabled
attribute:
enabled
: controls the enabled state of the TextField
. When false
, the text field will be neither editable nor focusable, the input of the text field will not be selectable, visually text field will appear in the disabled UI state
Something like:
var text by rememberSaveable { mutableStateOf("Text") }
TextField(
value = text,
onValueChange = { text = it },
enabled = false,
label = { Text("Label") },
singleLine = true
)