> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# setLassoBoxState

> 设置套索框状态。

<Note>
  必须套索之后才能调用该接口，否则会调用失败。
</Note>

```ts theme={null}
static setLassoBoxState(state: number): Promise<APIResponse<boolean>>;
```

**参数**

| 参数      | 类型       | 说明                                               |
| ------- | -------- | ------------------------------------------------ |
| `state` | `number` | `0` 显示，`1` 隐藏，`2` 完全移除，`3` 完全隐藏（包含套索元素），便于自定义工具条 |

**返回**

* [`APIResponse<boolean>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result === true` 表示设置成功

## 示例

```ts wrap theme={null}
import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * 设置套索框状态的示例。
 */
export async function exampleSetLassoBoxState() {
  const res = await PluginCommAPI.setLassoBoxState(1);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'setLassoBoxState 调用失败');
  }
  return res.result;
}
```
