Filled
A filled field with label, placeholder, and a Clear action when filled.
var text by rememberSaveable { mutableStateOf("") }
TextField(
value = text,
onValueChange = { text = it },
label = { Text("Name") },
placeholder = { Text("Enter your name") },
singleLine = true,
trailingIcon = {
if (text.isNotEmpty()) {
IconButton(onClick = { text = "" }) {
Icon(Icons.Filled.Clear, "Clear")
}
}
}
)