Material Design implementation in Jetpack compose of a TextField
Questions tagged [android-compose-textfield]
242 questions
105
votes
8 answers
How to close the virtual keyboard from a Jetpack Compose TextField?
I'm using the Jetpack Compose TextField and I want to close the virtual keyboard when the user press the the action button (imeActionPerformed parameter).
val text = +state { "" }
TextField(
value = text.value,
keyboardType =…

nglauber
- 18,674
- 6
- 70
- 75
84
votes
7 answers
Request Focus on TextField in jetpack compose
How to auto focus on textfield in jetpack compose. When i click on textfield and start typing on it. Meantime when i click back button,then when i'm try to click on textfield, nothing happens.
val textState = remember {…

Mukul jangir
- 941
- 1
- 4
- 3
60
votes
5 answers
How to set the inputType for a TextField in Jetpack Compose
I'd like to restrict what the user can type in a TextField in Jetpack Compose. How do I do that?
The equivalent in xml is inputType:

Cristan
- 12,083
- 7
- 65
- 69
57
votes
2 answers
Jetpack Compose how to remove EditText/TextField underline and keep cursor?
Hi I need to remove the underline in my TextField because it look ugly when the TextField is circular. I have sat the activeColor to transparent, but then the cursor wont show (because it's transparent). How can I remove the underline/activeColor…

Christer
- 2,746
- 3
- 31
- 50
48
votes
6 answers
Exposed drop-down menu for jetpack compose
I was wondering if there is a solution for Exposed drop-down menu for jetpack compose?
I couldn't find a proper solution for this component inside jetpack compose. Any help?

Stefan
- 2,829
- 5
- 20
- 44
47
votes
8 answers
TextField with hint text in jetpack compose
I want to create textfield with hint text in jetpackcompose. Any example how create textfield using jectpack? Thanks

affan ahmad
- 889
- 2
- 9
- 11
38
votes
4 answers
Jetpack compose: Setting ImeAction does not close or change focus for the keyboard
I'm using Jetpack compose 1.0.0-alpha07. I made a login screen that contains two TextFields customized using other composables.
However, setting ImeAction in keyboardOptions does not seem to work. For instance ImeAction.Next does not move focus to…

Mahdi-Malv
- 16,677
- 10
- 70
- 117
38
votes
4 answers
Jetpack Compose: Custom TextField design
In general, most components in Jetpack Compose seem to be very easy to customize.
However, the same cannot be said for the TextField. For example, say that I wanted to make something like this:
One would think that simply wrapping the BaseTextField…

foxtrotuniform6969
- 3,527
- 7
- 28
- 54
35
votes
5 answers
TextField maxLength - Android Jetpack Compose
Is there any out of the box solution for limiting the character size in TextField's ?
I don't see any maxLength parameter like we had in XML.

Stefan
- 2,829
- 5
- 20
- 44
34
votes
2 answers
How clear focus for BasicTextField in Jetpack Compose?
I have a Jetpack Compose (Beta04) BasicTextField (with decorationBox). How can I clear the focus?
I have tried with focusRequester but this doesn't works:
val focusRequester = remember { FocusRequester() }
// ...
BasicTextField(modifier =…

Tobi
- 507
- 1
- 5
- 13
32
votes
6 answers
How to use EditText or TextInput widget in Jetpack compose?
I was exploring Jetpack compose by trying a few widgets like Image and EditText.
For text input, it has EditableText. I have tried below code but it is not showing anything in UI
class MainActivity : AppCompatActivity() {
override fun…

Maddy
- 4,525
- 4
- 33
- 53
31
votes
7 answers
Jetpack Compose Decrease height of TextField
I am trying to design a search bar like Google search bar with decreased height. But the Input text is getting cropped also the placeholder text.
TextField(
value = searchText.value,
singleLine = true,
…

DelusionaL
- 745
- 2
- 6
- 15
30
votes
4 answers
How to show error message in OutlinedTextField in Jetpack Compose
I need to show error message in OutlinedTextField and I don't find any documentation about how to do it. I found several ways in tutorials, for example to create custom input field with hint or create Text just below input field, but they very old…

Camila
- 403
- 1
- 4
- 6
30
votes
6 answers
How to change the outline color of OutlinedTextField from jetpack compose?
Here is how OutlinedTextField code looks like in jetpack-compose:
OutlinedTextField(
value = "",
onValueChange = {},
label = {Text("Input")}
)
The default color of the outline of this TextField is purple. I want to change the outline…

Artaza Sameen
- 519
- 1
- 5
- 13
26
votes
1 answer
How to change TextField's highlighted text color on Jetpack Compose?
In currently transitioning my app to Jetpack compose and I'm facing some problems to adapt my current color palette in some cases.
I have some TextInputLayout on my xml files that inherit the highlight text color from SECUNDARY color on my…

Arthur Bertemes
- 976
- 14
- 21