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

# Set visibility (Beta)

> Set the visibility of an element.

## `element.setVisibility(visibility)`

Set the visibility of an element, or bind its visibility state to a data source.

Verify that the element has the `visibility` property before calling this method.

> **Beta**
>
> These methods are in public beta and may change with future releases.

## Syntax

```typescript
element.setVisibility(visibility: boolean): Promise<null>
element.setVisibility(binding: BindingInput): Promise<null>
```

Related types:

```typescript
type BindingInput =
  | { sourceType: 'prop'; propId: string }
  | { sourceType: 'cms'; collectionId: string; fieldId: string }
  | { sourceType: 'page'; fieldKey: string }
  | { sourceType: 'locale'; fieldKey: string }
  | { sourceType: 'localeItem'; fieldKey: string };
```

## Parameters

* **`visibility`**: `boolean | BindingInput` — `true` to show the element or `false` to hide it.
  Pass a `BindingInput` object to bind the visibility to a data source such as a CMS boolean field or component prop.

## Returns

**Promise\<`null`>**

A promise that resolves to `null` on success.

## Example

```typescript
const element = await webflow.getSelectedElement();

if (element?.visibility) {

  // Hide the element
  await element.setVisibility(false);

  // Show the element
  await element.setVisibility(true);

  // Bind visibility to a CMS boolean field
  await element.setVisibility({
    sourceType: 'cms',
    collectionId: 'col_abc',
    fieldId: 'field_xyz',
  });
}
```

## Designer Ability

| Designer Ability | Locale  | Branch | Workflow | Sitemode |
| :--------------- | :------ | :----- | :------- | :------- |
| **canDesign**    | Primary | Main   | Canvas   | Design   |