> For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt.

# getMenuButtonBoundingClientRect

取菜单按钮（右上角胶囊按钮）的布局位置信息。

## 扫码预览

![扫码预览 getMenuButtonBoundingClientRect](https://api.qrserver.com/v1/create-qr-code/?size=200x200\&data=doubao%3A%2F%2Fdoubao_apps%3Fapp_id%3Ddb_1McM5Ni%26path%3D%252Fpages%252Fapi%252Fui%252Fget-menu-button-bounding-client-rect%252Findex)

## 支持版本

前端库版本不低于 `0.0.26`。

## 支持平台

<table>
<thead>
<tr><th>平台</th><th>支持情况</th></tr>
</thead>
<tbody>
<tr><td>Android</td><td>支持</td></tr>
<tr><td>iOS</td><td>支持</td></tr>
<tr><td>PC</td><td>不支持</td></tr>
<tr><td>HarmonyOS</td><td>不支持</td></tr>
</tbody>
</table>

## 支持场景

<table>
<thead>
<tr><th>场景</th><th>支持情况</th></tr>
</thead>
<tbody>
<tr><td>页面</td><td>支持</td></tr>
<tr><td>卡片</td><td>不支持</td></tr>
</tbody>
</table>

## 使用说明

- 坐标单位为逻辑像素，与 CSS 像素一致，可直接用于页面布局定位。

## 调用方式

### 同步 API

```typescript
getMenuButtonBoundingClientRect(): MenuButtonBoundingClientRect
```

## 入参

无。

## 调用示例

```ts
import { getMenuButtonBoundingClientRect } from '@doubao-dev/framework/api';

const rect = getMenuButtonBoundingClientRect();

console.log(rect.width, rect.height);
console.log(rect.top, rect.right, rect.bottom, rect.left);
```

## 返回值

<table>
<thead>
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
</thead>
<tbody>
<tr><td><code>bottom</code></td><td><code>number</code></td><td>是</td><td>下边界坐标，单位 px。</td></tr>
<tr><td><code>height</code></td><td><code>number</code></td><td>是</td><td>高度，单位 px。</td></tr>
<tr><td><code>left</code></td><td><code>number</code></td><td>是</td><td>左边界坐标，单位 px。</td></tr>
<tr><td><code>right</code></td><td><code>number</code></td><td>是</td><td>右边界坐标，单位 px。</td></tr>
<tr><td><code>top</code></td><td><code>number</code></td><td>是</td><td>上边界坐标，单位 px。</td></tr>
<tr><td><code>width</code></td><td><code>number</code></td><td>是</td><td>宽度，单位 px。</td></tr>
</tbody>
</table>

### 返回示例

```json
{
  "width": 84,
  "height": 36,
  "top": 48,
  "right": 363,
  "bottom": 84,
  "left": 279
}
```
