Overview
Webflow Code Components allow you to build advanced, interactive React components in your codebase and deploy them to Webflow as shared libraries. Components can be visually composed on the canvas, enabling designers to use custom components without writing code.Code Components require a Webflow Workspace on Freelancer, Core, Growth, Agency, or Enterprise plan (or a site on CMS, Business, or Enterprise).
Download Skill
Add this skill to your AI agent to help with Code Components development:Quick Start
Key Concepts
Shadow DOM Isolation
Styles and DOM are sandboxed per component, preventing global CSS conflicts
Separate React Roots
No shared React Context or state between components
SSR by Default
Server-rendered HTML is hydrated on the client for better performance
declareComponent
Defines how your React component appears and behaves in Webflow
Prop Types
Code Components support 11 prop types for configuring components in the Webflow Designer:| Prop Type | Description | Use Case |
|---|---|---|
| Text | Single-line text input | Short strings, labels, titles |
| Rich Text | Formatted HTML content | Descriptions, articles |
| Text Node | On-canvas editable text | Headings that designers can style |
| Link | URL with target and preload | Navigation, CTAs |
| Image | Asset library image selection | Photos, illustrations, logos |
| Number | Numeric input with range | Counts, dimensions, opacity |
| Boolean | True/false toggle | Feature flags, visibility |
| Variant | Predefined option dropdown | Themes, sizes, styles |
| Visibility | Show/hide toggle | Conditional rendering |
| Slot | Child component insertion | Layouts, wrappers |
| ID | HTML element identifier | Accessibility, anchors |
Prop Type Example
Component Architecture
Shadow DOM & Styling
Because components render in Shadow DOM, global stylesheets won’t apply. Use one of these approaches:CSS-in-JS (Styled Components, Emotion)
CSS-in-JS (Styled Components, Emotion)
Tailwind CSS
Tailwind CSS
Configure Tailwind to work with Shadow DOM:
CSS Modules
CSS Modules
State & Data Management
- URL parameters — Share state via query strings
- Browser storage —
localStorageorsessionStorage - Nano Stores — Lightweight global state management
- Custom events —
window.postMessage()or custom events
Server-Side Rendering
Components are server-rendered by default for better performance and SEO. Disable SSR for browser-only components:Bundling & Import
Webpack bundles your library with a 50MB maximum size limit.
Important Notes
- React Server Components are not supported — use standard React components only
- Components can fetch data client-side, but APIs must support CORS
- Never embed API keys in component code — they’re visible in the browser
- Each component runs in its own Shadow DOM with isolated styles
Reference Documentation
The skill includes comprehensive reference documentation:Getting Started
- introduction.md — Overview of DevLink and code components
- quick-start.md — End-to-end tutorial from setup to canvas
- installation.md — CLI installation,
webflow.jsonconfig, authentication
Building Components
- define-code-component.md —
declareComponent, props, decorators, options - hooks.md —
declareComponentanduseWebflowContexthook reference - component-architecture.md — Shadow DOM, SSR, state patterns, data fetching
- styling-components.md — CSS in Shadow DOM, site variables, tag selectors
- frameworks-and-libraries.md — Tailwind, styled-components, Emotion, Material UI, Shadcn/UI
Prop Types
- prop-types.md — All prop types with usage, return values, and examples
- Individual files for each prop type (text.md, rich-text.md, link.md, etc.)
Bundling & CLI
- cli.md — Webflow CLI commands, flags, CI/CD usage, troubleshooting
- bundling-and-import.md — Webpack bundling, CLI import, CI/CD, debugging
Help
- faq.md — Frequently asked questions and troubleshooting