Styling & Theming
This guide covers how to style Weaverse components effectively using Tailwind CSS, implement global theme settings, and create consistent design systems across your storefront.Theme Setup
Before diving into styling, you need to set up the Weaverse theme system. This involves three key files that work together to provide dynamic theming capabilities.1. Root Layout Wrapper with withWeaverse
withWeaverse must wrap your root route’s Layout export — not the default route component. The Layout export wraps every render of the route, including error boundaries and 404 responses, so wrapping it keeps the Studio bridge and theme settings available even when a page fails to load.
2. Theme Schema Definition
Create a theme schema that defines all customizable settings for your storefront:media is optional and, unlike settings, never reaches the merchant: it filters what the Media Manager
gallery offers in this theme. An image or video input can override it for its own picker — see
Filtering the Media Manager gallery.
3. Global Style Component
Create a global style component that converts theme settings into CSS variables:4. Include Global Styles in Layout
Add theGlobalStyle component to your root Layout’s <head> section — the same Layout you wrapped with withWeaverse in step 1:
Global Theme Settings
Once your theme setup is complete, you can use theme settings throughout your components to create consistent, customizable designs.Using Theme Settings in Components
Access theme settings using theuseThemeSettings hook:
CSS Custom Properties Integration
Your Tailwind CSS can reference the CSS custom properties generated by yourGlobalStyle component:
Conditional Theme Settings
Theme schema supports conditional inputs that show/hide based on other settings:Theme Schema Configuration
Input Types Reference
Weaverse theme schema supports various input types for different customization needs:Advanced Schema Features
Section Headers
Help Text
Conditional Inputs
Dynamic Styling
Responsive Theme Settings
Your theme schema can include responsive values:GlobalStyle component with media queries:
Component-Level Theme Integration
Use theme settings directly in your Weaverse components:Tailwind CSS Integration
Weaverse works seamlessly with Tailwind CSS v4, providing utility-first styling for your components.Basic Styling
Class Utilities
Use thecn() utility for conditional classes:
Global Theme Settings
Accessing Theme Settings
Use theuseThemeSettings hook to access global theme configuration:
Theme Setting Schema
Define global theme settings in your theme configuration:Dynamic Color Variables
Create CSS custom properties for dynamic theming:Design System Patterns
Color Tokens
Tailwind CSS v4 is configured CSS-first — there is notailwind.config.js. Declare design tokens as CSS variables inside a @theme block and Tailwind generates the matching utilities (bg-brand-500, text-success, border-error-light, …) for you:
@theme inline when a token needs to reference another CSS variable that is set at runtime — for example the colors GlobalStyle writes from Weaverse theme settings:
Spacing Scale
Use a consistent spacing system, declared the same CSS-first way:Component Variants
Using Class Variance Authority (CVA)
Create robust component variants:Schema-Driven Variants
Integrate variants with Weaverse schemas:Responsive Design
Mobile-First Approach
Design components with mobile-first responsive patterns:Container Patterns
Create responsive container components:Responsive Text
Implement responsive typography:Color Management
Theme Color Integration
Create color inputs that work with your design system:CSS Custom Properties
Use CSS variables for dynamic theming:Typography System
Font Management
Implement consistent typography:Text Scale System
Create a consistent text scale:Spacing & Layout
Layout Components
Create reusable layout components:Best Practices
1. Design Tokens
Use consistent design tokens throughout your theme:2. Component Composition
Build complex components from simpler ones:3. Style Isolation
Keep component styles isolated and predictable:4. Performance Optimization
Optimize styles for performance:Next Steps
- Explore Component Schemas
- Learn about Input Settings
- Master Component Schemas
- Review Example Components