Get Selected Slot (Beta)

element.getSelectedSlot()

Returns the slot that is currently selected in the Designer on a component instance, or null if no slot is selected.

Use this to read the active slot context before appending or inspecting its children.

Beta

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

Syntax

element.getSelectedSlot(): Promise<SlotInstanceElement | null>

Returns

Promise<SlotInstanceElement | null>

A Promise that resolves to the selected SlotInstanceElement, or null if no slot is currently selected.

Example

const elements = await webflow.getAllElements();
const componentInstance = elements.find(el => el.type === 'ComponentInstance');
if (componentInstance?.type === 'ComponentInstance') {
const selectedSlot = await componentInstance.getSelectedSlot();
if (selectedSlot) {
const name = await selectedSlot.getDisplayName();
console.log(`Selected slot: ${name}`);
} else {
console.log('No slot is currently selected');
}
}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny