🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

KeyboardActions

Configures custom actions to run when the action button on the software keyboard (such as the "Done", "Search", or "Next" button in the bottom corner of the keyboard) is clicked.

Source set: Common
public class KeyboardActions(
    /**
     * This is run when the user triggers the [Done][ImeAction.Done] action. A null value indicates
     * that the default implementation if any, should be executed.
     */
    public val onDone: (KeyboardActionScope.() -> Unit)? = null,

    /**
     * This is run when the user triggers the [Go][ImeAction.Go] action. A null value indicates that
     * the default implementation if any, should be executed.
     */
    public val onGo: (KeyboardActionScope.() -> Unit)? = null,

    /**
     * This is run when the user triggers the [Next][ImeAction.Next] action. A null value indicates
     * that the default implementation should be executed. The default implementation moves focus to
     * the next item in the focus traversal order.
     *
     * See [Modifier.focusProperties()][androidx.compose.ui.focus.focusProperties] for more details
     * on how to specify a custom focus order if needed.
     */
    public val onNext: (KeyboardActionScope.() -> Unit)? = null,

    /**
     * This is run when the user triggers the [Previous][ImeAction.Previous] action. A null value
     * indicates that the default implementation should be executed. The default implementation
     * moves focus to the previous item in the focus traversal order.
     *
     * See [Modifier.focusProperties()][androidx.compose.ui.focus.focusProperties] for more details
     * on how to specify a custom focus order if needed.
     */
    public val onPrevious: (KeyboardActionScope.() -> Unit)? = null,

    /**
     * This is run when the user triggers the [Search][ImeAction.Search] action. A null value
     * indicates that the default implementation if any, should be executed.
     */
    public val onSearch: (KeyboardActionScope.() -> Unit)? = null,

    /**
     * This is run when the user triggers the [Send][ImeAction.Send] action. A null value indicates
     * that the default implementation if any, should be executed.
     */
    public val onSend: (KeyboardActionScope.() -> Unit)? = null,
)

Configures custom actions to run when the action button on the software keyboard (such as the "Done", "Search", or "Next" button in the bottom corner of the keyboard) is clicked.

Setting these actions overrides default behavior, allowing you to implement custom focus routing (e.g., moving focus to a specific field on Next) or trigger custom logic (e.g., hiding the keyboard or submitting data on Done).

Use KeyboardActionScope.defaultKeyboardAction to run the default action for the triggered ImeAction.

Functions

equals

Source set: Common
override fun equals(other: Any?): Boolean

hashCode

Source set: Common
override fun hashCode(): Int

Members

Companion

Source set: Common
public companion object

Properties

Default

Source set: Common
@Stable public val Default: KeyboardActions = KeyboardActions()

Use this default value if you don't want to specify any action but want to use the default action implementations.