Skip to main content
Themes control the visual appearance and user interface of your EverShop store. Unlike extensions (which handle logic), themes focus on the presentation layer using React components and Tailwind CSS.

What is a Theme?

A theme is a collection of React components that define how your store looks and feels. Themes:
  • Override default UI components with custom designs
  • Use Tailwind CSS for styling
  • Support TypeScript for type-safe development
  • Are modular - only override components you need
  • Work with areas - inject components into predefined page areas

Directory Structure

A typical theme follows this structure:

Creating Your First Theme

Creating Theme Components

Theme components are React components that render on specific pages. Each component must export:
  1. Default export - The React component
  2. layout export - Defines where and when the component renders
  3. query export (optional) - GraphQL query for data fetching

Component Structure

Here’s a real example from the anasuplements theme:
src/pages/all/Header.tsx

Layout Configuration

The layout export defines where your component appears:

Page Areas

EverShop uses a component area system. Common areas include:
Use lower sortOrder values to render components earlier in the area.

Directory Organization

Theme components are organized by page type:

Global Components (all/)

Components in src/pages/all/ appear on every page:

Area-Specific Components

Components for specific areas (frontStore, admin):

Page-Specific Components

Components for specific pages:

Working with Data

Use the query export to fetch data with GraphQL:
src/pages/frontStore/productView/SupplementInfo.tsx
The query export uses GraphQL to fetch data. Props are automatically passed to your component.

Styling with Tailwind CSS

All themes use Tailwind CSS for styling:

Custom Colors

Use custom color values with bracket notation:

Responsive Design

Use responsive modifiers:

Real-World Example: Ana’s Supplements Theme

The anasuplements theme demonstrates a complete theme implementation:

Best Practices

Component Reusability: Create small, reusable components that can be composed together.
  • Use TypeScript - Define proper types for props
  • Responsive First - Design for mobile, then scale up
  • Accessibility - Use semantic HTML and ARIA labels
  • Performance - Optimize images and minimize bundle size
  • Consistent Styling - Use a consistent color palette and spacing

Troubleshooting

Component Not Rendering

  1. Verify the layout export is present
  2. Check that areaId matches a valid area
  3. Ensure the component is in the correct directory
  4. Run npm run build to recompile

Styles Not Applying

  1. Verify Tailwind CSS classes are correct
  2. Check for typos in class names
  3. Ensure custom colors use bracket notation: bg-[#FFFFFF]

Data Not Loading

  1. Verify the GraphQL query is valid
  2. Check that field names match the schema
  3. Test the query in GraphQL playground

Next Steps

Page Components

Deep dive into page component architecture

Tailwind Design System

Learn about the Tailwind design system