Remove BasicTextField Indicator Bulb in Jetpack Compose?

Viewed 48

Im not sure what this is called so I call it a indicator bulb, its the image thats hanging off of the indicator. It appears above my bottom modal and I think that looks funky, how do we remove this?

image with indicator bulb

Image with bulb over the bottom sheet

1 Answers

You can hide the cursor using cursorBrush = SolidColor(Unspecified).

You have also to define a custom TextSelectionColors to override the default color provided by LocalTextSelectionColors.current that it is applied to the text selection and the TextFieldCursorHandle.

val customTextSelectionColors = TextSelectionColors(
    handleColor = Color.Transparent,
    backgroundColor = Color.Transparent
)

CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) {
   BasicTextField(
       value = text,
       onValueChange = {text = it},
       cursorBrush = SolidColor(Unspecified)
   )
}
Related