New component methods

These new functions are now available in the Designer API:

Beta

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

Getting the selected component

You can now retrieve the component that is currently being edited with the new webflow.getCurrentComponent() function (Beta). If no component is being edited, the method returns null.

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.');
}

For more information, see Get the selected component.

Getting an element’s parent component

You can now retrieve the component that directly contains a given element with the new element.getParentComponent() function (Beta). If the element is not inside a component, the method returns null.

const element = await webflow.getSelectedElement();
if (element) {
const parentComponent = await element.getParentComponent();
if (parentComponent) {
const name = await parentComponent.getName();
console.log(`Element is inside component: ${name}`);
} else {
console.log('Element is not inside a component.');
}
}

For more information, see Get the parent component.

Getting and setting component settings

The new component.getSettings() and component.setSettings() functions let you read and update a component’s name, group, and description in a single call:

const components = await webflow.getAllComponents();
const component = components[0];
// Read all settings at once
const settings = await component.getSettings();
console.log(settings.name); // 'Hero Section'
console.log(settings.group); // 'Sections'
console.log(settings.description); // 'A reusable hero with heading and CTA'
// Update only the description
await component.setSettings({
description: 'Updated hero layout with video background',
});
// Update all settings at once
await component.setSettings({
name: 'Hero Section v2',
group: 'Sections',
description: 'Redesigned hero component',
});

For more information, see: