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

# setButtonState

> Enable or disable a button.

```ts theme={null}
setButtonState(id: number, state: boolean): Promise<boolean>;
```

**Parameters**

| Parameter | Type      | Description                                               |
| --------- | --------- | --------------------------------------------------------- |
| `id`      | `number`  | Button ID (the `id` you used when registering the button) |
| `state`   | `boolean` | Button state: `true` enable, `false` disable              |

**Returns**

* `Promise<boolean>`:Set result

## Example

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

/**
 * Example: set button state.
 */
export async function exampleSetButtonState() {
 const ok = await PluginManager.setButtonState(1, false);
 return ok;
}
```
