Adds an event listener for keyboard-related events.
The type of event to listen for (e.g., "active").
Function that handles the event.
Optionaloptions: TypedEventListenerOptionsAdditional options for event listener behavior (optional).
Removes a previously added event listener.
The type of event to remove.
The event listener function to remove.
Sends a string of text to the active lens. The application should use this method to provide user-typed input to the lens for display.
The text to send to the lens. Supports escape sequences (e.g., \n for multiline input).
Dismisses the keyboard, clears the text input, and triggers an active event with active: false.
Applications can use this to remove on-screen text input elements when input is no longer needed.
The
KeyboardAPI enables applications to handle text input requests triggered by lenses.Lenses can request a keyboard display by emitting an
activeevent. The application is responsible for displaying a keyboard UI in response to this event.As users type, the application sends the typed text back to the lens using Keyboard.sendInputToLens, allowing the lens to display the text accordingly.
Lenses can also request the keyboard to be dismissed. When this happens, the application receives an event and should remove the displayed keyboard UI.
Example