1 /*
2  * Copyright 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.compose.foundation.text.input
18 
19 import androidx.compose.runtime.Stable
20 import androidx.compose.ui.Modifier
21 
22 @Stable
interfacenull23 fun interface KeyboardActionHandler {
24 
25     /**
26      * This is run when an IME action is performed by the software keyboard, or enter key is pressed
27      * on a hardware keyboard when the associated TextField is configured as single line. This
28      * callback replaces the default behavior for certain actions such as closing the keyboard or
29      * moving the focus to next field. If you also want to execute the default behavior, invoke
30      * [performDefaultAction].
31      *
32      * If you do not this callback to trigger when enter key is pressed on a single line TextField,
33      * refer to [Modifier.onPreviewKeyEvent] on how to intercept key events.
34      */
35     fun onKeyboardAction(performDefaultAction: () -> Unit)
36 }
37