Best Practices and Patterns
Best practices and patterns for using DevLink
There are many different ways of using DevLink in applications. Some common goals in practice might be:
- A “design systems” approach for building components in isolation in Webflow, and creating a library of composable components in React apps
- Building full pages as components in Webflow, and exporting them via DevLink
- Building skeleton layouts in Webflow, designing for dynamic content in mind
In this guide, you’ll find a collection of best practices and patterns for setting up DevLink components in Webflow and React for best maintainability and performance.
Best practices
Component size and structure
When building components in Webflow, you can choose between two main approaches to component architecture, or even mix them together based on your specific needs:
-
Complex Components: These are larger, self-contained components that represent complete UI sections or features. They’re ideal when you want to maintain consistency between your Webflow site and React app for entire sections of your interface.
- Use these for components that need to look and behave identically across both platforms
- Examples:
- Navigation bars (with all their states and interactions)
- Complete pricing tables (with all cells and styling)
- Full footers (with all links and sections)
- Entire page sections (like hero sections or feature blocks)
-
Atomic Components: These are smaller, reusable building blocks that form the foundation of your design system. They’re perfect for creating a consistent look and feel across your application.
- Use these for basic UI elements that you’ll combine in different ways
- Examples:
- Buttons (with different variants)
- Headings (with different sizes)
- Links (with different styles)
- Cards (with different layouts)
webflow devlink sync
command will override any changesAccessibility
DevLink components inherit their accessibility features from the Webflow elements they’re built upon. To ensure your components meet accessibility standards, follow Webflow’s accessibility guidelines. For detailed information on creating accessible elements in Webflow, refer to the Webflow Accessibility Guide.
Patterns
Repeatable lists
When working with lists of data in DevLink (like tables or item lists), we recommend splitting your components into two parts for better reusability and maintainability:
- A container component with a
slot
property that defines the overall structure and styling of the list - An item component that handles the rendering of individual list items
For example, let’s say you’re building a user management interface. You would create:
- A
UserTable
component in Webflow that defines the table structure and contains aslot
property for the table body - A
UserTableRow
component that defines how each user’s data should be displayed in a row
This separation allows you to:
- Keep the table structure consistent while dynamically rendering different data
- Reuse the row component in other contexts if needed
- Maintain a clear separation between the container and its contents
The example code below shows how to use these components together to display a list of users.
Webflow classes
When using DevLink, you may want to reuse Webflow classes in your custom React components. This is useful for maintaining the same styles and design across both Webflow and the web app.
CSS Modules (recommended)
If you are using CSS Modules in your app (default with DevLink), then you can import the relevant component CSS module and use it to access the classes in your custom components.
In the above example, we add the w-button
class to add Webflow’s default button styles.
Without CSS modules
If your app isn’t using CSS Modules, you can import the relevant component .css
file which will have all the component classes defined, and use the classes directly in your custom components.
If you aren’t using CSS Modules, make sure component styles don’t conflict with other component styles in your web app.
Using DevLink built-in elements
With DevLink builtin elements, you don’t need to set Webflow default classes when using CSS Modules. Using the builtin elements ensures you also reap out-of-the-box benefits from Webflow (for example, pre-load functionality)
Webflow forms
Use Webflow forms in your React app in two main ways:
- A single Webflow form exported as a whole component
- Composable forms via Webflow element components (for example, inputs, dropdowns, submit buttons, etc.)
Single Webflow form component
For simple forms (for example, one or two inputs without complex validation), we recommend exporting an entire Webflow form as a single component with DevLink. This will enable you to use the Webflow form as an uncontrolled React form in your app.
When you create a component from a Webflow form, add a Runtime prop to the root Form element in Webflow (for example, formProps
). This will enable you to pass in an onSubmit
event handler prop in your app. For example, consider a simple newsletter sign up form with an email and a submit button called NewsletterSignupForm
.


After importing this component into your app, using it in a React component might look like the following:
Composable forms with Webflow elements
If you’d rather build a form with finer control over state, validation, and submission, you can export form elements from Webflow and compose them in your app as needed. This approach is recommended for more complex and interactive forms, while allowing for consistent design and interactions across your Webflow site and React app.
For example, taking the same Newsletter above, you could export the Input
and FormButton
elements via DevLink into your project. Then, you can compose them in your app with a <form>
element and the use of 3rd party libraries to handle form state and validation.
Custom code
If you’ve added custom CSS to a Webflow page using custom code, note that it won’t be included in the DevLink-generated component since Webflow Page custom code isn’t exported with components. Also, generic class selectors (for example, [class="my-class"]
) won’t work since class names are namespaced uniquely.
To bring over any custom CSS to the web app that targets DevLink components:
- Add an Embed element inside the component
- Update custom CSS selectors to use the following pattern:
[class*="<ComponentName>_<class-name>__"] {...}
For example, take a Hero Section
component that has an element with a class "Hero Heading Center"
. In the Embed element, you can add the following custom CSS to target the namespaced class to add the custom CSS without worrying about it breaking in the DevLink generation.

Element tags
To bind an element tag to certain Webflow elements at runtime, there are a few recommended practices:
- For Heading elements, you can bind a prop to the
Tag
setting in Webflow and set the prop to"h1"
,"h2"
, etc. to set the correct heading level

-
For
div
elements, you don’t need to set up a Webflow prop to bind on the element. Simply set theas
prop to the desired element tag at runtime (for example,as="section"
)
Importing from the DevLink directory
Importing DevLink components directly from ./devlink
may be convenient. However, this could lead to bloated bundles and performance issues if your app’s bundler includes all components from the DevLink directory (including unused ones).
Instead, import specific components directly from the component source.