Android Jetpack Compose Keyboard Cheat Sheet

Thomas Bernard
2 min readJun 4, 2024

Jetpack composes a whole new way of writing user interfaces. It’s now much easier to make applications intuitive, and that means choosing the right keyboard for each action. In this article, we’ll take a look at the different types of keyboard available.

All Android Keyboard Cheat Sheet
Keyboard Types Cheat Sheet

You can modify the keyboard type as follows:

OutlinedTextField(
modifier = Modifier
.fillMaxWidth(),
value = "",
onValueChange = { },
label = { Text("Keyboard Cheat Sheet") },
keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.Password, // Change keyboard Type here
)
)

You can also change the action at the bottom right of the keyboard :

OutlinedTextField(
modifier = Modifier
.fillMaxWidth(),
value = "",
onValueChange = { },
label = { Text("Keyboard Cheat Sheet") },
keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.Password, // Change keyboard Type here
imeAction = ImeAction.Send // Change Action Here
)
)

Here is a summary of the different actions available:

Ime Actions Cheat Sheet

Some actions have basic behaviors, e.g. next will go to the next input, done will hide the keyboard. But you can override this default behavior by using keyboardActions :

OutlinedTextField(
modifier = Modifier
.fillMaxWidth(),
value = "",
onValueChange = { },
label = { Text("Keyboard Cheat Sheet") },
keyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.Text, // Change keyboard Type here
imeAction = ImeAction.Search // Change Action Here
),
keyboardActions = KeyboardActions(onSearch = {
// Code executed when user press search button
})
)

Thank you for reading this article. If you liked it or found it useful, please feel free to share it.

You can find my work on my github, where I publish projects of all kinds :

--

--