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
      • Get selected element
      • Set selected element
      • Get element children
      • Get the parent component
      • Get all elements
      • Insert element before target element
      • Insert element after target element
      • Nest element as first child
      • Nest element as last child
      • Bulk Add Elements
      • Remove element
    • Element Properties & Methods
    • Element Types & Methods
  • 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
  • webflow.getAllElements()
  • Syntax
  • Returns
  • Example
  • Designer Ability
ElementsCreating & Retrieving Elements

Get all elements

Was this page helpful?
Previous

Insert element before target element

Next
Built with

webflow.getAllElements()

Retrieve all elements present on the current page of the Designer.

If the Designer is editing a component, the elements returned are those present in that Component.

Syntax

1webflow.getAllElements(): Promise<Array<AnyElement>>

Returns

Promise<AnyElement>

A Promise that resolves to an array of AnyElement objects.

AnyElement represents the various element types available in a Webflow project. See a full list of supported element types in the Designer Extension type definitions.

Example

1// Retrieve all elements in the current context
2const allElements = await webflow.getAllElements();
3
4// Print element list
5if (allElements.length > 0) {
6 console.log("List of all elements:");
7
8 allElements.forEach((element, index) => {
9 console.log(`${index + 1}. Element ID: ${element.id}, Element Type: ${element.type}`);
10 });
11} else {
12 console.log("No elements found in the current context.");
13}

Try this example

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny