Skip to navigation

Get the selected component (Beta)

webflow.getCurrentComponent()

Retrieves the component that is currently being edited.

Beta

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

Syntax

webflow.getCurrentComponent(): Promise<Component | null>

Returns

Promise<Component>

A Promise that resolves to a component or null if no component is currently being edited.

Example

const component = await webflow.getCurrentComponent();
if (component) {
const name = await component.getName();
console.log(`Currently editing component: ${name}`);
// Example: get all elements inside the active component
const root = await component.getRootElement();
const children = await root.getChildren();
console.log(`Root has ${children.length} child element(s)`);
} else {
console.log('Not currently editing a component.');
}

Designer Ability

Checks for authorization only

Designer AbilityPermissionLocaleBranchWorkflowSitemode
canAccessCanvasanyanyanyanyany