TikTok for Developers

Developer Docs

Last updated October 5, 2026

UI

This API helps align the menu button within the mini game's navigation bar.

TTMinis.game.getMenuButtonBoundingClientRect()

Note: Requires base library version 0.3.0 or later. Lower versions require compatibility handling.

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

Returns

An object containing the layout position information of the menu button, with the following fields:

Field

Type

Description

width

double

The width, in pixels (px)

height

double

The height, in pixels (px)

top

double

The top edge coordinate, in pixels (px)

right

double

The right edge coordinate, in pixels (px)

bottom

double

The bottom edge coordinate, in pixels (px)

left

double

The left edge coordinate, in pixels (px)

Example

const res = TTMinis.game.getMenuButtonBoundingClientRect()

console.log(res.width)
console.log(res.height)
console.log(res.top)
console.log(res.right)
console.log(res.bottom)
console.log(res.left)
TikTok for Developers