Keyboard
Exposes device-level hardware interactions for on-screen keyboard control.
TTMinis.game.showKeyboard(opts)
Displays the keyboard.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The default value displayed in the keyboard input field | Yes |
|
| The maximum length of text in the keyboard | Yes |
|
| If | Yes |
|
| If | Yes |
|
| The type of the Confirm button in the lower-right corner of the keyboard. Only affects the button text. | Yes |
|
| The keyboard type. Defaults to text type. Numeric keyboard is supported on client version 8.0.57 or later. | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends. Called whether the call succeeds or fails. | No |
Example
TTMinis.game.showKeyboard({
defaultValue: "",
maxLength: 100,
multiple: false,
confirmHold: false,
confirmType: "done",
keyboardType: "text",
success(res) {
console.log("Keyboard shown");
},
fail(err) {
console.error(err);
}
});TTMinis.game.updateKeyboard(opts)
Updates the keyboard input field content. Only takes effect when the keyboard is visible.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The current value of the keyboard input field | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends. Called whether the call succeeds or fails. | No |
Example
TTMinis.game.updateKeyboard({
value: "NEW_VALUE",
success(res) {
console.log("Keyboard updated");
}
});TTMinis.game.hideKeyboard(opts)
Hides the keyboard.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends. Called whether the call succeeds or fails. | No |
Example
TTMinis.game.hideKeyboard({
success(res) {
console.log("Keyboard hidden");
}
});TTMinis.game.onKeyboardInput(listener)
Registers a listener for keyboard input events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function for keyboard input events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The current value of the keyboard input |
Example
const listener = function (res) {
console.log(res.value);
};
TTMinis.game.onKeyboardInput(listener);TTMinis.game.onKeyboardHeightChange(listener)
Registers a listener for keyboard height change events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function for keyboard height change events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The keyboard height in pixels |
Example
const listener = function (res) {
console.log("Keyboard height:", res.height);
};
TTMinis.game.onKeyboardHeightChange(listener);TTMinis.game.onKeyboardConfirm(listener)
Registers a listener for the keyboard Confirm button tap event.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function called when the user taps the Confirm button on the keyboard. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The current value of the keyboard input |
Example
const listener = function (res) {
console.log("Confirmed value:", res.value);
};
TTMinis.game.onKeyboardConfirm(listener);TTMinis.game.onKeyboardComplete(listener)
Registers a listener for keyboard dismiss events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function for keyboard dismiss events. Called with a response object. | Yes |
Response object
Field | Type | Description |
|
| The current value of the keyboard input |
Example
const listener = function (res) {
console.log("Keyboard dismissed, final value:", res.value);
};
TTMinis.game.onKeyboardComplete(listener);TTMinis.game.offKeyboardInput(listener)
Removes the listener for keyboard input events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onKeyboardInput(listener);
TTMinis.game.offKeyboardInput(listener); // Must pass the same function object used during registrationTTMinis.game.offKeyboardHeightChange(listener)
Removes the listener for keyboard height change events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onKeyboardHeightChange(listener);
TTMinis.game.offKeyboardHeightChange(listener); // Must pass the same function object used during registrationTTMinis.game.offKeyboardConfirm(listener)
Removes the listener for the keyboard Confirm button tap event.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onKeyboardConfirm(listener);
TTMinis.game.offKeyboardConfirm(listener); // Must pass the same function object used during registrationTTMinis.game.offKeyboardComplete(listener)
Removes the listener for keyboard dismiss events.
Note: Supported starting from SDK version 0.6.0. Lower versions must be adjusted for compatibility.
Parameters
Field | Type | Description | Required |
|
| The listener function passed to | No |
Example
const listener = function (res) {
console.log(res);
};
TTMinis.game.onKeyboardComplete(listener);
TTMinis.game.offKeyboardComplete(listener); // Must pass the same function object used during registration