853 B
853 B
TextField
TextField can be used to insert text. This is the equivalent to EditText from the Android View system.
@Composable
fun TextFieldDemo() {
Column(Modifier.padding(16.dp)) {
val textState = remember { mutableStateOf(TextFieldValue()) }
TextField(
value = textState.value,
onValueChange = { textState.value = it }
)
Text("The textfield has this text: " + textState.value.text)
}
}
See also:
- Handle changes in a TextField
- [Full Example Code]({{ site.samplefolder }}/other/TextFieldDemo.kt)
