Methods

simple-keyboard has a few methods you can use to further control its behavior. To access these functions, you need the instance of the keyboard component, like so:

const keyboard = new Keyboard({ ... }); // Then, use as follows... keyboard.methodName(params);

Input Management

MethodDescription
clearInputClear the keyboard's input.
getInputGet the keyboard's input (You can also get it from the onChange prop).
setInputSet the keyboard's input.
replaceInputReplace the input object completely.

Caret Position Management

MethodDescription
setCaretPositionChanges the internal caret position.
getCaretPositionGets the current caret position.

Button and Theme Management

MethodDescription
getButtonElementGets a button element (DOM element) of a given button.
addButtonThemeAdds/Updates the buttonTheme option with a new class for given buttons.
removeButtonThemeRemoves a className from the buttonTheme option.
recurseButtonsExecute an operation on each button.

Configuration and Control

MethodDescription
setOptionsSet new option or modify existing ones after initialization.
dispatchSend a command to all simple-keyboard instances at once (if you have multiple instances).
destroyDestroy keyboard listeners and DOM elements.