TikTok for Developers

开发者文档

上次更新时间:2026年10月22日

UI

Retrieve device information, get the capsule button's layout position, and customize the navigation bar appearance.

TTMinis.getDeviceInfo()

Gets device information synchronously.

Returns

Field

Type

Description

bottomHeight

number

The bottom safe area height.

Note: In development mode, the SDK may return additional debug fields such as screenWidth, screenHeight, platform, and system.

Example

const deviceInfo = TTMinis.getDeviceInfo();
console.log('deviceInfo:', deviceInfo);

TTMinis.getMenuButtonBoundingClientRect()

Gets the layout position of the menu button (the capsule button in the top-right corner). Coordinates are relative to the top-left corner of the screen.

Returns

Field

Type

Description

top

number

Top boundary coordinate, in px.

right

number

Right boundary coordinate, in px.

bottom

number

Bottom boundary coordinate, in px.

left

number

Left boundary coordinate, in px.

width

number

Width, in px.

height

number

Height, in px.

Example

const rect = TTMinis.getMenuButtonBoundingClientRect();
console.log('capsule rect:', rect);

TTMinis.setNavigationBarColor(options, callback)

Sets the navigation bar color.

Parameters

Field

Type

Description

Required

frontColor

string

The foreground color, such as #ffffff.

Yes

backgroundColor

string

The background color, such as #000000.

Yes

Callback parameters

Field

Type

Description

is_success

boolean

Whether the operation succeeded.

error

object

Returned on failure.

Example

TTMinis.setNavigationBarColor(
  {
    frontColor: '#ffffff',
    backgroundColor: '#161823',
  },
  function (res) {
    console.log('setNavigationBarColor:', res);
  },
);
TikTok for Developers