- In the
BasicTextField
you can hide the cursor using cursorBrush = SolidColor(Unspecified)
.
- In the
TextField
you can use the attribute colors = TextFieldDefaults.textFieldColors(cursorColor = Color.Unspecified)
The TextFieldCursorHandle
and the selected text use the color provided by LocalTextSelectionColors.current
You override this color defining a custom TextSelectionColors
:
val customTextSelectionColors = TextSelectionColors(
handleColor = Color.Transparent,
backgroundColor = Color.Transparent
)
CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) {
BasicTextField(
value = text,
onValueChange = {text = it},
cursorBrush = SolidColor(Unspecified)
)
TextField(
value = text,
onValueChange = {text = it},
colors = TextFieldDefaults.textFieldColors(cursorColor = Color.Unspecified)
)
}