Get visibility (Beta)

element.getVisibility()

Get the visibility of an element or whether its visibility state is bound 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

1element.getVisibility(): Promise<boolean>
2element.getVisibility(options: { bindings: true }): Promise<boolean | BindingValue | null>

Parameters

  • options (optional): { bindings: true } — When passed, returns binding metadata instead of the resolved boolean value if the visibility is bound to a data source.

Returns

  • Promise<boolean>: true if the element is visible, false if it is hidden.
  • Promise<boolean | BindingValue | null> (when { bindings: true } is passed): A BindingValue object if the visibility is bound to a data source, or null if the visibility is unset.

Example

1const element = await webflow.getSelectedElement();
2
3if (element?.visibility) {
4
5 // Check current visibility
6 const isVisible = await element.getVisibility();
7 console.log(isVisible); // true or false
8
9 // Read binding metadata
10 const value = await element.getVisibility({ bindings: true });
11 // Returns BindingValue when bound, or boolean when static
12}

Designer Ability

Checks for authorization only.

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny