Setup

Learn how to set up and configure your React project for exported components.

This reference covers the configuration required to export Webflow components into a React project using DevLink.

Install the Webflow CLI

Install the CLI as a development dependency to your React project to bundle and publish your component library:

$npm install -D @webflow/webflow-cli@latest
Minimum versions

DevLink Export requires @webflow/webflow-cli v1.19.0 or later, running on Node.js v22 or higher. The minimum supported React version for using exported components is v18.

Create a configuration file

DevLink looks for a webflow.json file in the root of your project, which defines settings for DevLink setup and export. You can generate this file with the webflow devlink export command as described in Quickstart: DevLink Export, or you can write your own.

Here is an example webflow.json file for DevLink Export:

1{
2 "siteId": "69d8ea201293ab4c87c1a2e3",
3 "devlink-export": {
4 "rootDir": "./webflow",
5 "components": ".*",
6 "componentGroups": ".*",
7 "ts": true,
8 "cssScopes": true,
9 "relativeHrefRoot": "/"
10 }
11}

The .webflowrc.js file that previous versions of DevLink used is deprecated. Projects should migrate to webflow.json.

Configuration options

siteId sits at the top of webflow.json; every other option below lives under the devlink-export object.

OptionDescriptionDefault
siteIdWebflow site IDprocess.env.WEBFLOW_SITE_ID
rootDirDirectory to export components into./webflow
cssScopesEnable CSS @scope wrapping for component stylestrue
tsGenerate TypeScript files for exported componentsAuto-detected from tsconfig.json and .ts/.tsx files in the project on first export
componentsRegex pattern to match components to export.*
componentGroupsRegex pattern to match component groups to export.*
relativeHrefRootHow relative href values are rewritten in exported Link and Image components/

Details for some of these options are covered in sections below.

relativeHrefRoot

Controls how exported Link components rewrite href values for internal page links, section anchors, and CMS-page links. External URLs, mailto:, tel:, and asset links are exported as-is regardless of this setting.

ValueDescriptionNotes
/Internal page link → root-relative path; section → #fragment; CMS page → /<slug>Default when configured via the CLI
A string URLPrepend this base URL to internal paths (for example, https://my-site.com)A trailing slash on the base URL is stripped before concatenation
falseDevLink doesn’t rewrite internal links — they render as href="#" placeholdersUse this when you’ll override link rendering yourself, for example by passing a custom renderLink to DevLinkProvider
Example:
  • With "/":

    • Page link to “About” → href="/about"
    • Section link → href="#contact-section"
    • CMS page link → href="/blog/my-blog-post"
  • With "https://my-site.com":

    • Page link to “About” → href="https://my-site.com/about"
    • Section link → href="https://my-site.com#contact-section"
    • CMS page link → href="https://my-site.com/blog/my-blog-post"

Next steps