I have an OutlinedTextField in jetpack compose and I want to change the label direction to the right of OutlinedTextField for the Persian language (By default is on the left).

Use CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl).
Sample code,
@Composable
fun RtlLabelInOutlineTextField() {
val (digit1, setDigit1) = remember {
mutableStateOf("")
}
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
OutlinedTextField(
value = digit1,
onValueChange = {
setDigit1(it)
},
label = {
Text("Label")
},
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.NumberPassword,
imeAction = ImeAction.Next,
),
modifier = Modifier.fillMaxWidth().padding(16.dp),
)
}
}
Screenshots

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With