TikTok for Developers

Developer Docs

Last updated October 1, 2026

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

defaultValue

string

The default value displayed in the keyboard input field

Yes

maxLength

int32

The maximum length of text in the keyboard

Yes

multiple

Boolean

If true, enables multi-line input. If false, enables single-line input.

Yes

confirmHold

Boolean

If true, keeps the keyboard visible after the Confirm button is tapped. If false, hides the keyboard.

Yes

confirmType

string

The type of the Confirm button in the lower-right corner of the keyboard. Only affects the button text.

Yes

keyboardType

string

The keyboard type. Defaults to text type. Numeric keyboard is supported on client version 8.0.57 or later.

Yes

success

function

The callback function called when the API call succeeds

No

fail

function

The callback function called when the API call fails

No

complete

function

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

value

string

The current value of the keyboard input field

Yes

success

function

The callback function called when the API call succeeds

No

fail

function

The callback function called when the API call fails

No

complete

function

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

success

function

The callback function called when the API call succeeds

No

fail

function

The callback function called when the API call fails

No

complete

function

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

listener

function

The listener function for keyboard input events. Called with a response object.

Yes

Response object

Field

Type

Description

value

string

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

listener

function

The listener function for keyboard height change events. Called with a response object.

Yes

Response object

Field

Type

Description

height

int32

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

listener

function

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

value

string

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

listener

function

The listener function for keyboard dismiss events. Called with a response object.

Yes

Response object

Field

Type

Description

value

string

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

listener

function

The listener function passed to onKeyboardInput. If not provided, all listeners are removed. Must be the same function object used during registration.

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 registration

TTMinis.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

listener

function

The listener function passed to onKeyboardHeightChange. If not provided, all listeners are removed. Must be the same function object used during registration.

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 registration

TTMinis.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

listener

function

The listener function passed to onKeyboardConfirm. If not provided, all listeners are removed. Must be the same function object used during registration.

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 registration

TTMinis.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

listener

function

The listener function passed to onKeyboardComplete. If not provided, all listeners are removed. Must be the same function object used during registration.

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
TikTok for Developers