
Attach native keyboard accessory toolbars and customizable input actions to TextField via modifier; focus-aware lifecycle, SF Symbols icons, flexible spacers, dynamic real-time updates.
Native iOS keyboard toolbars for Compose text fields, with a shared Kotlin Multiplatform API.
English | 한국어
Add native input accessories to ordinary Compose Multiplatform TextField, OutlinedTextField, and BasicTextField components without replacing them with UIKit text fields. Compose continues to own text state and focus.
On iOS, a host uses Compose’s public platform text-input interception APIs to supply a native UIToolbar as the active text-input session’s accessory view. The same common API is available on other configured targets, where native accessory rendering is currently a no-op.
Six iOS sample configurations; select an image to view it at full resolution.
Modifier.inputActions, under a shared host.Plain / Done styles, and flexible spacing with UIKit’s toolbar appearance.InputAction.Done() hides the software keyboard while preserving focus; custom callbacks can clear focus or move between fields.| Platform | Configured targets | Native accessory support |
|---|---|---|
| iOS |
iosArm64, iosSimulatorArm64
|
Implemented with UIKit |
| Android | Android library | No-op |
| Desktop (JVM) | jvm |
No-op |
| macOS | macosArm64 |
No-op |
| Web (Wasm JS) |
wasmJs browser |
No-op |
No-op targets retain common registration behavior but do not display toolbar items or provide native toolbar taps. There are no configured iosX64, macosX64, or JavaScript (js) targets.
| Feature | Android support | iOS support | Implementation |
|---|---|---|---|
| Host and focus registration | Common registry | Common registry | CompositionLocal and Modifier nodes |
| Text / icon actions and styles | No native UI | Implemented |
UIBarButtonItem, SF Symbols |
| Flexible spacing | No native UI | Implemented | Native flexible-space items |
| Updates to an existing toolbar | No native UI | Implemented | Replace items in the current toolbar |
| Shared background controls | No native UI | iOS 26+ | UIKit background properties and separator items |
This table describes the current implementation, not a device or accessibility certification. See limitations.
The verified Maven Central release is zone.ien.inputactions:inputactions:1.0.0. The current checkout declares 1.0.1 in the version catalog; that is the source version, not a confirmed Central release.
Add the repositories if your project does not already declare them, then add the dependency to your shared module:
// settings.gradle.kts
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}// build.gradle.kts (shared module)
kotlin {
sourceSets {
commonMain.dependencies {
implementation("zone.ien.inputactions:inputactions:1.0.0")
}
}
}Alternatively, use a Version Catalog:
# gradle/libs.versions.toml
[versions]
inputactions = "1.0.0"
[libraries]
inputactions = { module = "zone.ien.inputactions:inputactions", version.ref = "inputactions" }commonMain.dependencies {
implementation(libs.inputactions)
}Platform setup: Place InputActionsHost around the relevant UI as shown in Quick Start. This library requires no separate SPM package or custom MainViewController integration on iOS. Configure your application’s regular Compose Multiplatform targets as usual. On other targets the host adds no native accessory UI.
[!IMPORTANT] The current checkout is configured with Kotlin 2.4.21, Compose Multiplatform 1.12.2, AGP 9.3.1, Gradle 9.5.1, and JDK 17. These are repository build versions, not a tested minimum compatibility range for consumers. See Compatibility & Limitations.
This example uses Material 3’s OutlinedTextField; your app must also depend on Compose Material 3. The library itself depends on Compose UI, Foundation, and Runtime, not Material 3.
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import zone.ien.inputactions.InputAction
import zone.ien.inputactions.InputActionsHost
import zone.ien.inputactions.inputActions
@Composable
fun NoteField() {
var text by remember { mutableStateOf("") }
InputActionsHost {
OutlinedTextField(
value = text,
onValueChange = { text = it },
modifier = Modifier.inputActions(InputAction.Done()),
label = { Text(text = "Note") },
)
}
}Done() is a composable factory. It hides the software keyboard without clearing focus and does nothing if no keyboard controller is available. Put one host around the relevant screen or app subtree; individual fields do not each need a host. Without a host, inputActions does not register actions.
Use Compose FocusRequester for navigation. The first field uses the keyboard-only Done() helper; the second uses a labeled custom action that clears focus.
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalFocusManager
import zone.ien.inputactions.*
@Composable
fun RegistrationForm() {
var name by remember { mutableStateOf("") }
var email by remember { mutableStateOf("") }
val nameFocus = remember { FocusRequester() }
val emailFocus = remember { FocusRequester() }
val focusManager = LocalFocusManager.current
InputActionsHost {
Column {
OutlinedTextField(
value = name,
onValueChange = { name = it },
modifier = Modifier
.focusRequester(nameFocus)
.inputActions(
InputAction(
title = "Next",
icon = InputActionIcon("chevron.down"),
onClick = { emailFocus.requestFocus() },
),
InputAction.Done(),
),
label = { Text(text = "Name") },
)
OutlinedTextField(
value = email,
onValueChange = { email = it },
modifier = Modifier
.focusRequester(emailFocus)
.inputActions(
InputAction(
title = "Previous",
icon = InputActionIcon("chevron.up"),
onClick = { nameFocus.requestFocus() },
),
InputAction(
title = "Done",
style = InputActionStyle.Done,
onClick = { focusManager.clearFocus() },
),
),
label = { Text(text = "Email") },
)
}
}
}Inside the form above, this modifier places Next and Clear on the left, with a separate Done group on iOS 26 and later:
Modifier.inputActions(
InputAction(title = "Next", onClick = { emailFocus.requestFocus() }),
InputAction(title = "Clear", onClick = { name = "" }),
InputAction.FlexibleSpace(separatesSharedBackground = true),
InputAction(
title = "Done",
style = InputActionStyle.Done,
onClick = { focusManager.clearFocus() },
),
)Without an explicit FlexibleSpace, the toolbar inserts one before the final action when there are multiple actions, or before a single Done-style action. An explicit spacer gives you control over the boundary.
separatesSharedBackground = true keeps both groups’ backgrounds visible. On a regular action the separator goes before the action; on a flexible spacer it goes after the gap.hidesSharedBackground = true removes the item’s shared background instead. It does not mean “start a separate group.”Inside InputActionsHost in the Quick Start example, replace the field declaration with the following. Clear appears when text is nonempty:
val clearAction = InputAction(title = "Clear", onClick = { text = "" })
val doneAction = InputAction.Done()
val actions = if (text.isEmpty()) {
listOf(doneAction)
} else {
listOf(clearAction, doneAction)
}
OutlinedTextField(
value = text,
onValueChange = { text = it },
modifier = Modifier.inputActions(*actions.toTypedArray()),
)Registered actions and an existing toolbar’s items are updated while the field is focused. Attaching a new accessory after an input session started without one has a separate limitation described below.
See the sample screen for six text, icon, spacing, and background configurations.
InputActionsHost(content: @Composable () -> Unit) supplies the internal registry and platform integration to its content. content is required; the registry is disposed with the host.
Modifier.inputActions(vararg actions: InputAction): Modifier registers the actions while the field owns focus. Zero or more actions are accepted; an empty list supplies no actions. Focus loss or node detachment removes the registration. No caller-assigned field ID is needed.
The public constructor in InputAction.kt:
InputAction(
title: String = "",
style: InputActionStyle = InputActionStyle.Plain,
icon: InputActionIcon? = null,
hidesSharedBackground: Boolean = false,
separatesSharedBackground: Boolean = false,
onClick: () -> Unit,
)| Parameter | Type | Default | Behavior |
|---|---|---|---|
title |
String |
"" |
Button text; retained as a human-readable title when an icon is shown |
style |
InputActionStyle |
Plain |
Native presentation style |
icon |
InputActionIcon? |
null |
SF Symbol displayed instead of text on iOS; falls back to title if lookup fails |
hidesSharedBackground |
Boolean |
false |
Hide the item’s shared background on iOS 26+ |
separatesSharedBackground |
Boolean |
false |
Insert a native group separator on iOS 26+ |
onClick |
() -> Unit |
Required | Callback for the action |
All constructor values are exposed as read-only properties. isFlexibleSpace: Boolean is also read-only and is set by spacer factories, not by the public constructor. A spacer’s title and callback are not used as a visible action.
| API | Defaults / behavior |
|---|---|
@Composable InputAction.Done(icon, style) |
icon = InputActionIcon("checkmark"), style = InputActionStyle.Done; hides the software keyboard and retains focus |
InputAction.FlexibleSpace |
Flexible spacer with both background flags false
|
InputAction.FlexibleSpace(hidesSharedBackground, separatesSharedBackground) |
Both Boolean arguments default to false
|
InputAction.flexibleSpace(hidesSharedBackground, separatesSharedBackground) |
Lowercase alias with identical defaults and behavior |
InputActionStyle.Plain |
Regular native button style |
InputActionStyle.Done |
Emphasized native button style; does not itself dismiss the keyboard |
InputActionIcon(systemName: String) |
Data class holding an SF Symbol name on iOS |
Use a meaningful title on custom icon actions so UIKit can retain a human-readable label. Symbol availability depends on the iOS version. Done() has no title parameter; use the constructor for a labeled Done action. Passing icon = null to Done() produces an empty title with no icon.
minSdk 29 and compileSdk 37; the sample uses targetSdk 37. JVM compilation targets Java 17. The sample’s Xcode project sets iOS 18.2 as its deployment target; this is not a verified minimum for the published library.InterceptPlatformTextInput / platform IME option APIs. It does not traverse UIKit view hierarchies, swizzle responders, or create a competing hidden UITextField. Compatibility with arbitrary Compose releases is not guaranteed.inputAccessoryView; it is not merged with a custom accessory. Other explicitly copied platform IME settings, including inputView, are forwarded. With no active actions, the original request is passed through.Use JDK 17 and the checked-in wrapper. Android tasks require SDK 37; iOS builds and tests require macOS and Xcode.
./gradlew :library:assemble
./gradlew :library:jvmTest
./gradlew :library:iosSimulatorArm64Testassemble builds the configured library outputs. jvmTest runs common tests on JVM; iosSimulatorArm64Test runs common and iOS tests on an Apple Silicon simulator. A compatible simulator must be available. See common tests and iOS tests.
The sample app contains Android, iOS, and Wasm JS entry points using the public API. Its shared screen demonstrates standard text actions, explicit spacing, a single Done action, icon actions, hidden backgrounds, and separate icon groups.
# Android: install on a connected device or emulator
./gradlew :example:androidApp:installDebug
# Web: start the Wasm JS development server
./gradlew :example:composeApp:wasmJsBrowserDevelopmentRun
# iOS: open the Xcode project
open example/iosApp/iosApp.xcodeprojFor iOS, choose the iosApp scheme and an Apple Silicon simulator or physical device. Xcode’s build phase invokes Gradle to build and embed the Compose framework. For physical devices, select your own signing team and bundle identifier in Xcode / Config.xcconfig. There is no JVM or macOS sample entry point.
Released under the Apache License 2.0. The existing project and IENLAB copyright notices are retained below.
Copyright (c) 2026. Compose Input Actions project and open source contributors.
Copyright (c) 2026. IENGROUND of IENLAB.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Native iOS keyboard toolbars for Compose text fields, with a shared Kotlin Multiplatform API.
English | 한국어
Add native input accessories to ordinary Compose Multiplatform TextField, OutlinedTextField, and BasicTextField components without replacing them with UIKit text fields. Compose continues to own text state and focus.
On iOS, a host uses Compose’s public platform text-input interception APIs to supply a native UIToolbar as the active text-input session’s accessory view. The same common API is available on other configured targets, where native accessory rendering is currently a no-op.
Six iOS sample configurations; select an image to view it at full resolution.
Modifier.inputActions, under a shared host.Plain / Done styles, and flexible spacing with UIKit’s toolbar appearance.InputAction.Done() hides the software keyboard while preserving focus; custom callbacks can clear focus or move between fields.| Platform | Configured targets | Native accessory support |
|---|---|---|
| iOS |
iosArm64, iosSimulatorArm64
|
Implemented with UIKit |
| Android | Android library | No-op |
| Desktop (JVM) | jvm |
No-op |
| macOS | macosArm64 |
No-op |
| Web (Wasm JS) |
wasmJs browser |
No-op |
No-op targets retain common registration behavior but do not display toolbar items or provide native toolbar taps. There are no configured iosX64, macosX64, or JavaScript (js) targets.
| Feature | Android support | iOS support | Implementation |
|---|---|---|---|
| Host and focus registration | Common registry | Common registry | CompositionLocal and Modifier nodes |
| Text / icon actions and styles | No native UI | Implemented |
UIBarButtonItem, SF Symbols |
| Flexible spacing | No native UI | Implemented | Native flexible-space items |
| Updates to an existing toolbar | No native UI | Implemented | Replace items in the current toolbar |
| Shared background controls | No native UI | iOS 26+ | UIKit background properties and separator items |
This table describes the current implementation, not a device or accessibility certification. See limitations.
The verified Maven Central release is zone.ien.inputactions:inputactions:1.0.0. The current checkout declares 1.0.1 in the version catalog; that is the source version, not a confirmed Central release.
Add the repositories if your project does not already declare them, then add the dependency to your shared module:
// settings.gradle.kts
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}// build.gradle.kts (shared module)
kotlin {
sourceSets {
commonMain.dependencies {
implementation("zone.ien.inputactions:inputactions:1.0.0")
}
}
}Alternatively, use a Version Catalog:
# gradle/libs.versions.toml
[versions]
inputactions = "1.0.0"
[libraries]
inputactions = { module = "zone.ien.inputactions:inputactions", version.ref = "inputactions" }commonMain.dependencies {
implementation(libs.inputactions)
}Platform setup: Place InputActionsHost around the relevant UI as shown in Quick Start. This library requires no separate SPM package or custom MainViewController integration on iOS. Configure your application’s regular Compose Multiplatform targets as usual. On other targets the host adds no native accessory UI.
[!IMPORTANT] The current checkout is configured with Kotlin 2.4.21, Compose Multiplatform 1.12.2, AGP 9.3.1, Gradle 9.5.1, and JDK 17. These are repository build versions, not a tested minimum compatibility range for consumers. See Compatibility & Limitations.
This example uses Material 3’s OutlinedTextField; your app must also depend on Compose Material 3. The library itself depends on Compose UI, Foundation, and Runtime, not Material 3.
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import zone.ien.inputactions.InputAction
import zone.ien.inputactions.InputActionsHost
import zone.ien.inputactions.inputActions
@Composable
fun NoteField() {
var text by remember { mutableStateOf("") }
InputActionsHost {
OutlinedTextField(
value = text,
onValueChange = { text = it },
modifier = Modifier.inputActions(InputAction.Done()),
label = { Text(text = "Note") },
)
}
}Done() is a composable factory. It hides the software keyboard without clearing focus and does nothing if no keyboard controller is available. Put one host around the relevant screen or app subtree; individual fields do not each need a host. Without a host, inputActions does not register actions.
Use Compose FocusRequester for navigation. The first field uses the keyboard-only Done() helper; the second uses a labeled custom action that clears focus.
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalFocusManager
import zone.ien.inputactions.*
@Composable
fun RegistrationForm() {
var name by remember { mutableStateOf("") }
var email by remember { mutableStateOf("") }
val nameFocus = remember { FocusRequester() }
val emailFocus = remember { FocusRequester() }
val focusManager = LocalFocusManager.current
InputActionsHost {
Column {
OutlinedTextField(
value = name,
onValueChange = { name = it },
modifier = Modifier
.focusRequester(nameFocus)
.inputActions(
InputAction(
title = "Next",
icon = InputActionIcon("chevron.down"),
onClick = { emailFocus.requestFocus() },
),
InputAction.Done(),
),
label = { Text(text = "Name") },
)
OutlinedTextField(
value = email,
onValueChange = { email = it },
modifier = Modifier
.focusRequester(emailFocus)
.inputActions(
InputAction(
title = "Previous",
icon = InputActionIcon("chevron.up"),
onClick = { nameFocus.requestFocus() },
),
InputAction(
title = "Done",
style = InputActionStyle.Done,
onClick = { focusManager.clearFocus() },
),
),
label = { Text(text = "Email") },
)
}
}
}Inside the form above, this modifier places Next and Clear on the left, with a separate Done group on iOS 26 and later:
Modifier.inputActions(
InputAction(title = "Next", onClick = { emailFocus.requestFocus() }),
InputAction(title = "Clear", onClick = { name = "" }),
InputAction.FlexibleSpace(separatesSharedBackground = true),
InputAction(
title = "Done",
style = InputActionStyle.Done,
onClick = { focusManager.clearFocus() },
),
)Without an explicit FlexibleSpace, the toolbar inserts one before the final action when there are multiple actions, or before a single Done-style action. An explicit spacer gives you control over the boundary.
separatesSharedBackground = true keeps both groups’ backgrounds visible. On a regular action the separator goes before the action; on a flexible spacer it goes after the gap.hidesSharedBackground = true removes the item’s shared background instead. It does not mean “start a separate group.”Inside InputActionsHost in the Quick Start example, replace the field declaration with the following. Clear appears when text is nonempty:
val clearAction = InputAction(title = "Clear", onClick = { text = "" })
val doneAction = InputAction.Done()
val actions = if (text.isEmpty()) {
listOf(doneAction)
} else {
listOf(clearAction, doneAction)
}
OutlinedTextField(
value = text,
onValueChange = { text = it },
modifier = Modifier.inputActions(*actions.toTypedArray()),
)Registered actions and an existing toolbar’s items are updated while the field is focused. Attaching a new accessory after an input session started without one has a separate limitation described below.
See the sample screen for six text, icon, spacing, and background configurations.
InputActionsHost(content: @Composable () -> Unit) supplies the internal registry and platform integration to its content. content is required; the registry is disposed with the host.
Modifier.inputActions(vararg actions: InputAction): Modifier registers the actions while the field owns focus. Zero or more actions are accepted; an empty list supplies no actions. Focus loss or node detachment removes the registration. No caller-assigned field ID is needed.
The public constructor in InputAction.kt:
InputAction(
title: String = "",
style: InputActionStyle = InputActionStyle.Plain,
icon: InputActionIcon? = null,
hidesSharedBackground: Boolean = false,
separatesSharedBackground: Boolean = false,
onClick: () -> Unit,
)| Parameter | Type | Default | Behavior |
|---|---|---|---|
title |
String |
"" |
Button text; retained as a human-readable title when an icon is shown |
style |
InputActionStyle |
Plain |
Native presentation style |
icon |
InputActionIcon? |
null |
SF Symbol displayed instead of text on iOS; falls back to title if lookup fails |
hidesSharedBackground |
Boolean |
false |
Hide the item’s shared background on iOS 26+ |
separatesSharedBackground |
Boolean |
false |
Insert a native group separator on iOS 26+ |
onClick |
() -> Unit |
Required | Callback for the action |
All constructor values are exposed as read-only properties. isFlexibleSpace: Boolean is also read-only and is set by spacer factories, not by the public constructor. A spacer’s title and callback are not used as a visible action.
| API | Defaults / behavior |
|---|---|
@Composable InputAction.Done(icon, style) |
icon = InputActionIcon("checkmark"), style = InputActionStyle.Done; hides the software keyboard and retains focus |
InputAction.FlexibleSpace |
Flexible spacer with both background flags false
|
InputAction.FlexibleSpace(hidesSharedBackground, separatesSharedBackground) |
Both Boolean arguments default to false
|
InputAction.flexibleSpace(hidesSharedBackground, separatesSharedBackground) |
Lowercase alias with identical defaults and behavior |
InputActionStyle.Plain |
Regular native button style |
InputActionStyle.Done |
Emphasized native button style; does not itself dismiss the keyboard |
InputActionIcon(systemName: String) |
Data class holding an SF Symbol name on iOS |
Use a meaningful title on custom icon actions so UIKit can retain a human-readable label. Symbol availability depends on the iOS version. Done() has no title parameter; use the constructor for a labeled Done action. Passing icon = null to Done() produces an empty title with no icon.
minSdk 29 and compileSdk 37; the sample uses targetSdk 37. JVM compilation targets Java 17. The sample’s Xcode project sets iOS 18.2 as its deployment target; this is not a verified minimum for the published library.InterceptPlatformTextInput / platform IME option APIs. It does not traverse UIKit view hierarchies, swizzle responders, or create a competing hidden UITextField. Compatibility with arbitrary Compose releases is not guaranteed.inputAccessoryView; it is not merged with a custom accessory. Other explicitly copied platform IME settings, including inputView, are forwarded. With no active actions, the original request is passed through.Use JDK 17 and the checked-in wrapper. Android tasks require SDK 37; iOS builds and tests require macOS and Xcode.
./gradlew :library:assemble
./gradlew :library:jvmTest
./gradlew :library:iosSimulatorArm64Testassemble builds the configured library outputs. jvmTest runs common tests on JVM; iosSimulatorArm64Test runs common and iOS tests on an Apple Silicon simulator. A compatible simulator must be available. See common tests and iOS tests.
The sample app contains Android, iOS, and Wasm JS entry points using the public API. Its shared screen demonstrates standard text actions, explicit spacing, a single Done action, icon actions, hidden backgrounds, and separate icon groups.
# Android: install on a connected device or emulator
./gradlew :example:androidApp:installDebug
# Web: start the Wasm JS development server
./gradlew :example:composeApp:wasmJsBrowserDevelopmentRun
# iOS: open the Xcode project
open example/iosApp/iosApp.xcodeprojFor iOS, choose the iosApp scheme and an Apple Silicon simulator or physical device. Xcode’s build phase invokes Gradle to build and embed the Compose framework. For physical devices, select your own signing team and bundle identifier in Xcode / Config.xcconfig. There is no JVM or macOS sample entry point.
Released under the Apache License 2.0. The existing project and IENLAB copyright notices are retained below.
Copyright (c) 2026. Compose Input Actions project and open source contributors.
Copyright (c) 2026. IENGROUND of IENLAB.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.