APIsChangelog
Log In

Exit out of a component

webflow.exitComponent()

Exit the focus of the Designer from a component definition. After exiting out of a component, the focus of the Designer will return to the body of the page.

Syntax

webflow.exitComponent(): Promise<null>

Returns

Promise<null>

A Promise that resolves to null when the context switch is successful.

Example

await webflow.exitComponent()
const rootElement = await webflow.getRootElement()
const rootElementType = rootElement?.type

// Print Root Element Type. If element type is Body, the Designer has exited out of the Component context
console.log(`Element Type: ${rootElementType}`)