FAQs and troubleshooting
Find answers to common questions about code components, from setup to troubleshooting. If you need to report a an issue, please follow the steps in this guide to contact the Webflow team.
Getting started
How do I create my first code component?
See the getting started guide for detailed steps.
Which frameworks can I use?
Code components support React with TypeScript. You can use:
- React hooks and functional components
- TypeScript for type safety
- Popular React libraries (with some limitations)
- CSS-in-JS solutions (with configuration)
Development and styling
Why can't I see my component styles?
Code components render in Shadow DOM, which isolates styles. Common issues:
- Site classes don’t work - Use component-specific CSS classes
- CSS-in-JS libraries need configuration - See bundling guide
How do I use my site variables?
Reference site variables in your component CSS:
Get the exact variable name from the Variables panel in Webflow Designer.
Can I use external APIs in my components?
Yes, but with important limitations:
- Client-side only - No server-side rendering
- Public APIs only - Don’t include auth tokens or secrets
- CORS considerations - APIs must allow cross-origin requests
Example of safe API usage:
Deployment and updates
How do I update a component in my library?
- Make your changes locally
- Run
npx webflow library share
to deploy - The updated component replaces the previous version
Note: You can’t update individual components - the entire library is deployed as one unit.
Can I test components locally before deploying?
Yes, use the local bundling feature:
This creates a dist
folder you can serve locally for testing.
How do I handle component versioning?
Currently, code components don’t support versioning. Each deployment replaces the previous version. Consider:
- Using Git for version control
- Testing thoroughly before deployment
- Keeping deployment logs for rollback reference
Troubleshooting
My component isn't rendering
Check these common issues:
- Build errors - Check your terminal for compilation errors
- Missing dependencies - Ensure all imports are available
- Bundle size - Keep under 50MB limit
- Single root element - Components must have one root element (no fragments)
Styles aren't applying correctly
Shadow DOM limitations can cause styling issues:
- Site classes - Use component-specific classes instead
- CSS-in-JS - Configure for Shadow DOM (see bundling guide)
- Inheritance - Use
inherit
values for cross-boundary styling
Component state isn't persisting
Each code component runs in its own React root, so:
- React Context doesn’t work across components
- Redux/global state isn’t shared between components
- Use alternatives like URL parameters,
localStorage
, or external state management
Learn more about component architecture and state management when building code components.
Library deployment fails
Common deployment issues:
- Authentication - Ensure your Workspace token is valid in your
.env
file - Bundle size - Check if you’re under the 50MB limit
- Build errors - Fix any compilation issues first
- Network issues - Check your internet connection
Performance and limitations
What's the bundle size limit?
Maximum bundle size is 50MB. To optimize:
- Use tree shaking
- Minimize dependencies
- Remove unused code
- Optimize images and assets
Can I use server-side rendering?
Not currently. Code components render only on the client side. Server-side rendering is planned for future releases.
Can I use third-party libraries?
Most React libraries work, but some have limitations:
- Multiple entry points - Libraries with ESM + CJS may not work
- Style injection - CSS-in-JS libraries need Shadow DOM configuration
- Global dependencies - Libraries that modify
window
ordocument
may conflict
Learn more about styling components when building code components.
Advanced topics
How do I debug my components?
- Browser dev tools - Inspect the Shadow DOM
- Console logging - Add
console.log
statements - Local bundling - Use
--dev
flag for better error messages - Source maps - Enable for easier debugging
Can I use TypeScript?
Yes, TypeScript is fully supported. Use .tsx
files for your components and configure tsconfig.json
for your project.
How do I handle responsive design?
Use standard CSS media queries within your component:
Can I use animations and transitions?
Yes, CSS animations and transitions work normally within the Shadow DOM boundary. Use standard CSS animation properties and @keyframes
.