Search code examples
androidandroid-textinputlayoutandroid-jetpack-composeandroid-compose-textfield

How to remove indicator line of TextField in Androidx Compose Material?


I would like to remove the purple line/indicator (see the following image) of TextField. Is that possible or should I create my own custom TextField to achieve that?

enter image description here


Solution

  • If You use TextField in that you can give the activeColor to Color.Transparent

    Note: activeColor is not only for indicator, its for label bottom indicator and cursor

    Ex:

        var text: String by mutableStateOf("")
        TextField(value = text, onValueChange = {
            text = it
        }, activeColor = Color.Transparent)
    

    As per the document, activeColor is

    activeColor the color of the label, bottom indicator and the cursor when the text field is in focus

    If you want to use your own you can try BaseTextField