2

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
  • try reducing the fontSize , also u can tinker with height and styles Commented Jun 16, 2021 at 13:59

2 Answers 2

1

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 ) ) 
Sign up to request clarification or add additional context in comments.

Comments

0

You need to set a TextStyle and specify the font size that the cursor will assume a similar size.

BasicTextField( ... textStyle = TextStyle( color = Color.Black, fontSize = 10.sp, // Cursor should be the similar size. textAlign = textAlign, ), ) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.