Change size of cursor in TextField (Jetpack Compose)

Viewed 995

I want to decrease the 'height' of cursor in my TextField. How do I do that?

My TextField with default cursor height looks like:

My TextField

1 Answers

We can custom the text field cursor via CoreTextField.cursorBrush, with Brush.verticalGradient and colorStops argument.

BasicTextField(
    cursorBrush = Brush.verticalGradient(
        0.00f to Color.Transparent,
        0.35f to Color.Transparent,
        0.35f to Color.Green,
        0.90f to Color.Green,
        0.90f to Color.Transparent,
        1.00f to Color.Transparent
    )
)
Related