Getting Started
This guide will walk you through the setup of a basic Designer Extension replaces the text of an element with “Lorem Ipsum”. By the end of this guide, you’ll have completed the following steps:
- Install the Webflow CLI
- Initialize a Designer Extension starter project
- Run a Designer Extension in the Webflow Designer
- Update Elements on a page
- Modify Designer Extension with the Designer APIs
Prerequisites
To successfully follow along with this guide, please ensure your system meets the following requirements and you have the following resources:
- Node.js 16.20 or later
- A Webflow site for development and testing
- A registered Webflow App that’s installed to your test site. If you haven’t set up an App yet, please follow our guide on creating an App.
Install the Webflow CLI
Webflow’s CLI is a command-line interface that allows you to create, manage, and deploy Designer Extensions. It provides a set of commands for initializing, building, and running your Designer Extension, as well as for interacting with the Designer APIs.
To create a Designer Extension, you’ll need to install the Webflow CLI.
Create a Designer Extension
The Webflow CLI provides a command to create a new Designer Extension with a basic structure and settings.
This command will create a new project folder with the necessary files and structure for your Designer Extension. Additionally, the CLI offers templates to work with specific libraries and frameworks, including React and Typescript.
Run your Designer Extension locally
Now that you’ve created your Designer Extension, let’s run it locally for development. The CLI provides a convenient development server that will automatically rebuild your extension whenever you make changes.
Run the following command in your project directory:
This will serve the Designer Extension on port 1337 using the CLI command webflow extension serve
and run webpack in watch mode with npm run watch-webpack
concurrently. Running these commands concurrently allows you to both serve your extension and automatically rebuild it whenever you make code changes, enabling a smooth development experience with live updates.
Note that the Designer Extension will only be fully functional when loaded within the Webflow interface.
Open your Designer Extension in Webflow
To see your Designer Extension running in Webflow, you’ll need to load it in the Webflow Designer. Ensure your App is installed to your test site and open your test site in the Webflow Designer.
Click on the “Apps” icon in the left panel, and locate and click on your App to open its detail pane. Click on the “Launch development App” button to see your Designer Extension running in the Webflow Designer.
Modify elements with the Designer APIs
This code that modifies elements is located in src/index.ts
.
Update code in the Designer Extension
Let’s add some additional logic to our Designer Extension to handle a scenario where an element isn’t selected, or an element doesn’t have text content.
To change this, add an else
clause to the if
statement in index.ts
and use the webflow.notify()
method to notify a user that they should choose an element.
Save these changes to your index.ts
, and try selecting a non-text element to see the notification.
Next Steps
Congratulations! You’ve build and run your first Designer Extension. To dive deeper into what you can do with Designer Extensions, check out our documentation on:
- The Designer API.
- Building and deploying Designer Extensions.
- Submitting your App to the Webflow Marketplace.