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
      • Element Presets
      • DOM Elements
      • Strings
      • Components
        • Get Component
        • Search props
        • Get Props
        • Get Resolved Props
        • Set Props
        • Reset All Props
        • Get Slots
        • Get Selected Slot
        • Get Text Prop Element
        • Unlink Component
      • Slots
      • Headings
      • Images
      • Links
      • Forms
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • 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
  • element.getComponent()
  • Syntax
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsComponents

Get Component

Was this page helpful?
Previous

Search props (Beta)

Next
Built with

element.getComponent()

Retrieves the associated component definition of the component instance.

Syntax

1element.getComponent(): Promise<Component>

Returns

Promise<Component>

A Promise that resolves to a Component Object

Example

1// Select Component Element on Page
2const elements = await webflow.getAllElements()
3const componentInstance = elements.find(el => el.type === 'ComponentInstance')
4
5if (componentInstance?.type === "ComponentInstance") {
6
7 // Get Component object from instance
8 const component = await componentInstance?.getComponent()
9 const componentName = await component.getName()
10 console.log(componentName)
11} else {
12 console.log("No component element found")
13}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny