> This page is for Designer API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.webflow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server.

# Check for a Designer mode

## `webflow.isMode()`

Returns a boolean that shows whether the Designer is currently in the specified mode.

Use this method when you need to branch on a single mode and don't need the full list of modes.
To read the current mode directly, use [`webflow.getCurrentMode()`](/designer/reference/get-current-mode).

### Syntax

```typescript
webflow.isMode(mode: AppModeName): Promise<boolean>
```

### Parameters

**`mode`**: `AppModeName`

The mode to check for.
One of `"design"`, `"build"`, `"preview"`, `"edit"`, or `"comment"`.
See [`webflow.getCurrentMode()`](/designer/reference/get-current-mode) for the full list of modes and what each one represents.

### Returns

**Promise\<*boolean*>**

A Promise that resolves to `true` when the Designer is in the specified mode, or `false` otherwise.

### Example

```typescript
if (await webflow.isMode("design")) {
  // Run layout-editing code only in Design mode.
  await insertElement();
}
```

[Try this example](https://webflow.com/oauth/authorize?response_type=code\&client_id=19511de1ec410f9228d8dcbc9420e67916dea80d86d18f0c9a533eb475ea0f62)

### Example: Checking a mode before an action

Block an action and notify the user when the Designer is in the wrong mode for the operation:

```typescript
async function insertDivIfInDesignMode() {
  if (!(await webflow.isMode("design"))) {
    await webflow.notify({
      type: "Error",
      message: "Switch to Design mode to insert elements.",
    });
    return;
  }

  const el = await webflow.getSelectedElement();
  if (el) {
    await el.append(webflow.elementPresets.DivBlock);
  }
}

await insertDivIfInDesignMode();
```

[Try this example](https://webflow.com/oauth/authorize?response_type=code\&client_id=19511de1ec410f9228d8dcbc9420e67916dea80d86d18f0c9a533eb475ea0f62)