Getting Started with Exported Components

Export your Webflow components to a Next.js project in minutes with DevLink

In this guide, you’ll learn how to configure DevLink and export components to a React project. While this guide uses Next.js, Code Export works with any React-based framework.

Before you start

Before running this quickstart, make sure you have:

  • A Webflow account and Webflow site with components to export. Or, use a Code Export template from the Webflow marketplace. DevLink templates are pre-configured with components and styles optimized for React.
  • Node.js v20.0.0 or higher and npm installed
  • Basic familiarity with React
1

Create a Next.js project

To start with a fresh Next.js project, run the following command in your terminal:

$npx create-next-app@latest my-devlink-app
>cd my-devlink-app

Follow the prompts to configure your project with your preferred options.

2

Install the Webflow CLI

In your React project, install the Webflow CLI as a development dependency:

$npm install -D @webflow/webflow-cli
3

Authenticate with Webflow

DevLink requires API access to your site to export your design system. To grant access, run the following command in your terminal to start an authentication workflow:

$webflow auth login

This command will open an authentication screen in your browser. Follow the prompts to authenticate with Webflow. Once authenticated, the CLI will create a .env file in the root of your project with your Site ID and API token.

Existing .env file

If you already have a .env file in your project, the CLI will require you to add a --force flag to make changes.

2. Prepare your Webflow components

In your Webflow project, prepare any components you want to export to your React project by:

  • Selecting an element or group of elements
  • Right-clicking and selecting “Create Component”
  • Naming your component (use clear, descriptive names)
Creating a Component in Webflow

Only elements that have been converted to Components can be exported via DevLink.

3. Export and use your components

1

Export your components

Run the DevLink sync command to export your Webflow components to your React project:

$ webflow devlink sync

This will create a devlink directory in your project containing:

  • React components for each of your Webflow components
  • CSS modules for component-specific styling
  • A global CSS file for shared styles
  • A DevLinkProvider component for handling interactions
3

Use your components

Now you can import and use your Webflow components in your application. In this particular example, it uses three components exported from Webflow via DevLink: Hero, Card, and Button. You can use them in your application like so:

app/page.tsx
1import { Button } from '@/devlink/Button';
2import { Card } from '@/devlink/Card';
3import { Hero } from '@/devlink/Hero';
4
5export default function Home() {
6 return (
7 <main>
8 <Hero
9 heading="Welcome to My App"
10 subheading="Built with Webflow and DevLink"
11 />
12 <Card
13 title="DevLink Card"
14 description="This card was designed in Webflow"
15 >
16 <Button>Get Started</Button>
17 </Card>
18 </main>
19 );
20}
The props set on these React components depend on the design and properties set up on the Webflow components
4

Start your development server

Run your application to see your Webflow components in action:

$npm run dev

Visit http://localhost:3000 in your browser to see your application with the Webflow components.

Updating your components

When you make changes to your components in Webflow, simply run the sync command again to update them in your React project:

$webflow devlink sync

This will update all your components while preserving any custom code or props you’ve added in your React application.

Common issues and solutions

If you encounter authentication issues:

  • Verify your API token has the correct permissions
  • Ensure your environment variables are properly loaded
  • Check that the webflow.json file is in the root directory

If your components don’t look the same as in Webflow:

  • Ensure you’ve imported global.css in your application
  • Import any additional fonts used on your site to your layout file
  • Verify that the DevLinkProvider is properly set up
  • Check for CSS conflicts with other styles in your project

If a component isn’t available after syncing:

  • Make sure it’s properly created as a Component in Webflow
  • Check if it uses only supported elements

Next steps