fun TextField(title: String, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)Overview
Pass the current text and update it in the callback. Typing calls your callback and recomposes before SwiftUI draws the next frame, so the cursor never jumps.
TextField("Name", text = name, onTextChange = { name = it })This is the Kotlin form of SwiftUI TextField.init(_:text:): SwiftUI documentation. In Swift it reads:
@export(implementation) nonisolated init<S>(_ title: S, text: Binding<String>) where S : StringProtocolTopics
Creating a TextField
fun TextField(title: String, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onEditingChanged: (Boolean) -> Unit, onCommit: () -> Unit)
fun TextField(title: String, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onEditingChanged: (Boolean) -> Unit)
fun TextField(title: String, text: String, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(title: String, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onCommit: () -> Unit)
fun TextField(title: String, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(text: String, axis: Axis, modifier: Modifier = Modifier, prompt: String? = null, onTextChange: (String) -> Unit, content: @Composable () -> Unit)
fun TextField(text: String, modifier: Modifier = Modifier, prompt: String? = null, onTextChange: (String) -> Unit, content: @Composable () -> Unit)
fun TextField(titleKey: LocalizedKey, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onEditingChanged: (Boolean) -> Unit, onCommit: () -> Unit)
fun TextField(titleKey: LocalizedKey, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onEditingChanged: (Boolean) -> Unit)
fun TextField(titleResource: LocalizedKey, text: String, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(titleResource: LocalizedKey, text: String, prompt: String?, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(title: String, text: String, prompt: String?, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(titleResource: LocalizedKey, text: String, prompt: String?, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(title: String, text: String, prompt: String?, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(titleKey: LocalizedKey, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit, onCommit: () -> Unit)
fun TextField(titleResource: LocalizedKey, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextField(titleKey: LocalizedKey? = null, text: String? = null, axis: Axis? = null, prompt: String? = null, modifier: Modifier = Modifier, onTextChange: ((String) -> Unit)? = null)
Methods
fun TextFieldText(titleKey: LocalizedKey, text: String, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextFieldText(titleKey: LocalizedKey, text: String, prompt: String?, axis: Axis, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextFieldText(titleKey: LocalizedKey, text: String, prompt: String?, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)
fun TextFieldText(titleKey: LocalizedKey, text: String, modifier: Modifier = Modifier, onTextChange: (String) -> Unit)