theme.config.ts
theme.config.ts is the “shape” of your theme:
- which settings exist (colors, typography, etc.)
- which sections exist (header, hero, footer, etc.)
- which fields are editable in the Theme Builder
Think of
theme.config.ts as a schema for customization. Your theme reads the values at runtime and decides how to render them.Minimal Example
How Shoppex Uses This (Conceptually)
In short:- Shoppex reads your config to know what is customizable.
- Merchants change values in a Theme Builder UI.
- Shoppex publishes the settings for a shop.
- Your theme fetches the published settings and applies them (usually as CSS variables).
Setting Field Types
Every field insettings or sections[*].settings must have a type. There are 10 types:
color
A hex color picker.
text
A single-line text input.
range
A numeric slider with bounds.
select
A dropdown. Options can be plain strings or { value, label } objects.
boolean
A toggle switch.
image
A single image upload. Default is usually null.
font
A font family picker. Optionally restrict choices with options.
richtext
A rich-text editor (HTML output).
products
A product picker. Returns an array of product IDs.
images
A multi-image upload. Returns an array of URLs.
TypeScript Interfaces
The full type definitions live inpackages/sdk/src/types/theme-config.ts.
Use
satisfies ThemeConfig (not as ThemeConfig) so TypeScript validates the structure while preserving exact types for autocomplete.Reference Config (Default Theme)
A condensed version of the reference theme’s config showing all settings groups and sections (values taken fromthemes/default/theme.config.ts):
Common Mistakes
Putting runtime code into theme.config.ts
Putting runtime code into theme.config.ts
Keep runtime code in
src/. The config should be plain data so tools can parse it safely.Changing setting keys later
Changing setting keys later
Treat keys like
colors.primary as stable. Changing keys breaks existing published settings.Next Steps
Theme Settings
How defaults + published overrides are merged and applied.
Theme Package Format
Which files matter for a distributable theme.
Sources
- Theme config types:
packages/sdk/src/types/theme-config.ts - Reference theme config:
themes/default/theme.config.ts