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.openCanvas(target)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Error handling
  • Designer Ability
ComponentsManaging Components

Open a Component canvas (Beta)

Was this page helpful?
Previous

Set the selected variant (Beta)

Next
Built with

webflow.openCanvas(target)

Open a Component’s canvas or a page for editing in the Designer.

To specify the Component to open, pass one of the following objects:

  • Component
  • ComponentInstance
  • A component ID as a string

You can also open a page for editing by passing a Page object. In this case, this method behaves the same as the webflow.switchPage() method.

Beta

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

Syntax

1webflow.openCanvas(target: Component | ComponentElement | Page): Promise<void>;
2webflow.openCanvas(target: OpenCanvasOptions): Promise<void>;

Where OpenCanvasOptions is one of:

1interface OpenCanvasByComponentId {
2 componentId: string;
3}
4
5interface OpenCanvasByPageId {
6 pageId: string;
7}
8
9type OpenCanvasOptions = OpenCanvasByComponentId | OpenCanvasByPageId;

Parameters

target: One of the following values:

TypeDescription
ComponentA Component to open in the Designer
ComponentElementA Component instance to specify the Component to open in the Designer
PageA page to open in the Designer
{ componentId: string }The ID of the Component to open in the Designer
{ pageId: string }The ID of a page to open in the Designer

Returns

Promise<void>

A Promise that resolves when the canvas or page has opened.

Example

1// Open a Component canvas by ID
2await webflow.openCanvas({ componentId: 'component-id' });
3
4// Open a Component canvas by Component reference
5const components = await webflow.getAllComponents();
6const hero = components[0];
7await webflow.openCanvas(hero);
8
9// Open a Component canvas via an instance reference
10const selectedElement = await webflow.getSelectedElement();
11if (selectedElement?.type === 'ComponentInstance') {
12 await webflow.openCanvas(selectedElement as ComponentElement);
13}
14
15// Navigate to a page by ID
16await webflow.openCanvas({ pageId: 'page-id' });
17
18// Navigate to a page by reference (equivalent to webflow.switchPage)
19const pagesAndFolders = await webflow.getAllPagesAndFolders();
20const pages = pagesAndFolders?.filter((i): i is Page => i.type === 'Page');
21await webflow.openCanvas(pages[0]);

Try this example


Error handling

ScenarioError tagMessage
Invalid component IDInvalidRequest"Invalid component ID"
Invalid page IDInvalidRequest"Invalid page ID"
Component canvas not availableInvalidRequest"Component canvas is not available in the current mode"
No access to the component or pageUnauthorized

The component canvas is only available in Design mode. Calling openCanvas() with a component ID or reference in Build mode throws an InvalidRequest error.

Designer Ability

Designer AbilityLocaleBranchWorkflowSiteMode
canModifyComponentsanyanycanvasDesign