For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
      • Create a component instance
      • Open a component canvas
      • Set the selected variant
      • Select a component
      • Exit out of a component
      • Get root element
      • Get component name
      • Get component
      • Set component name
      • Get component settings
      • Set component settings
      • Get props
      • Create a prop
      • Create multiple props
      • Get a prop
      • Get a prop by name
      • Set prop settings
      • Remove a prop
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • webflow.enterComponent(instance)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ComponentsManaging Components

Select a component

Was this page helpful?
Previous

Exit out of a component

Next
Built with

webflow.enterComponent(instance)

Focus the Designer on a component definition to make changes to a component definition. When a component is in focus, all supported Designer APIs and methods operate specifically on that component definition, not the entire Site.

Syntax

1webflow.enterComponent(
2 instance: ComponentElement
3): Promise<null>

Parameters

  • instance: ComponentElement - A Component Instance that’s present on the page. If there’s no current instance, you’ll need to create one first.

Returns

Promise<null>

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

Example

1// Step 1: Fetch the currently selected element
2const selectedElement = await webflow.getSelectedElement();
3
4if (selectedElement && selectedElement.type === "ComponentInstance") {
5
6 // Step 2: Enter the context of the selected ComponentElement
7 await webflow.enterComponent(selectedElement as ComponentElement);
8 console.log("Successfully entered the component context.");
9
10 // Step 3: After entering the component's context, fetch the root element
11 const rootElement = await webflow.getRootElement();
12 if (rootElement) {
13 console.log("Root element of the component:", rootElement);
14 } else {
15 console.log("No root element found in this component context.");
16 }
17
18} else {
19 console.log("The selected element is not a ComponentElement.");
20}

Try this example


Designer Ability

Designer AbilityLocaleBranchWorkflowSiteMode
canModifyComponentsanyanycanvasDesign