How clear focus for BasicTextField in Jetpack Compose?

To clear focus from the currently focused component you can use the FocusManager.clearFocus method: val focusRequester = remember { FocusRequester() } val focusManager = LocalFocusManager.current var value by rememberSaveable { mutableStateOf(“initial value”) } BasicTextField( value = value, onValueChange = { value = it }, decorationBox = { innerTextField -> Row( Modifier .background(Color.LightGray, RoundedCornerShape(percent = 30)) … Read more

Jetpack Compose: Custom TextField design

You can use the TextField: removing the label with label = null applying custom color with the TextFieldDefaults.textFieldColors parameter to hide the indicator. adding in the onValueChange a function to fix the max number of characters as described here Finally use a Column to add 2 Text composables to complete the external label and counter … Read more

Jetpack compose: Setting ImeAction does not close or change focus for the keyboard

You can use keyboardOptions: software keyboard options that contains configuration such as KeyboardType and ImeAction keyboardActions when the input service emits an IME action, the corresponding callback is called For Done: You can use the LocalSoftwareKeyboardController to interact with the keyboard. keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), keyboardActions = KeyboardActions( onDone = {keyboardController?.hide()} ) For Next: … Read more