# Wave

Source: https://developers.swell.is/storefronts/wave-app

> **Note:** Wave is in early access and may not be available in your store yet. [Sign up for our newsletter](https://www.swell.is/newsletter) for updates.

Wave is Swell's storefront app with a visual editor and an AI agent, and the one Swell recommends. This page covers building and publishing themes for it; for using Wave in a store, see the [Wave guide](https://developers.swell.is/app-guides/wave). Wave's agent calls AI through Swell's AI gateway, as any app can; see [AI](https://developers.swell.is/apps/ai).

A Wave theme is a Swell app that gives storefronts built with Wave their sections, page templates and design. Wave is Swell's storefront app with a visual editor and an AI agent: merchants edit a theme's pages by clicking a section or by describing a change to the agent, then publish. See [Wave](https://developers.swell.is/app-guides/wave) for the merchant's side.

Wave themes are written in React and TypeScript. Sections render on the server, and no section code runs in the shopper's browser. Every Wave theme, Swell's own included, is built on the same package, `@swell/wave-theme-core`, and passes the same checks. For themes in general, see [Themes](https://developers.swell.is/apps/themes).

You can build a Wave theme for the Theme Store, free or paid, or as a custom theme for one client's store. The theme is built the same way for both. See [Publishing themes](https://developers.swell.is/storefronts/selling-themes) for listing, review and pricing, and Building for a client below.

## How a Wave theme is built

A Wave theme has three layers. You write only the top one.

| Layer | What it is | Owned by |
| --- | --- | --- |
| ui-kit | The components and design tokens (--uk-*) that sections build with: images, headings, prices, product forms, payment icons and more. Wave provides them when a page renders, so a theme never ships them. | Swell |
| @swell/wave-theme-core | The sections every storefront needs (header, footer, product details, cart, account, search, blog, policies, the not-found page and more) with their blocks, templates, Store text and menu areas, plus the build and checks. Its code can't be changed; themes restyle it with tokens and settings. | Swell, versioned |
| Your theme | Your design (colors, fonts, spacing), your own sections and blocks, your templates, header and footer groups, theme settings and any new Store text. | You |

A Wave theme app has `"type": "theme"` and `theme.storefront.app` set to `wave`:

**swell.json**

```json
{
  "id": "my_theme",
  "name": "My Theme",
  "type": "theme",
  "version": "1.0.0",
  "description": "A bright storefront for small batch food brands",
  "theme": {
    "storefront": {
      "app": "wave"
    }
  }
}
```

- `swell theme build` copies the core's files, then your theme's files over them, checks the result and writes the theme app. Your templates and groups replace the core's with the same name, and your Store text and menu areas merge with the core's.
- When a merchant creates a storefront from a theme, the storefront gets its own copy of the theme files. The editor and the agent change that copy's draft, and Publish makes it live.
- Each section renders on the server in an isolated worker, and its HTML is checked before it is served. A section that fails is left out of the page. One small script from Wave handles the cart drawer, the variant picker, search suggestions and menus; links and forms work without it.
- A new published version of the theme reaches existing storefronts as an update the merchant reviews in the editor (see Versions and updates).

## What you need

- The Swell CLI 2.9.41 or later (`npm install -g @swell/cli`) and Node.js 22 or later. See [Swell CLI](https://developers.swell.is/apps/cli). On an older CLI, `swell theme --help` lists only `dev`, `init`, `pull` and `push`: update it to get `create`, `check` and `build`.
- A Swell [development store](https://www.swell.is/help/partners/development-stores) to preview in, with products, categories, content pages and blog posts so every page type has data. A partner account can have 5 development stores by default; to ask for more, email partnerships@swell.is. Development stores take test payments only, can't connect a custom domain, and open in the new Swell dashboard. Usage on a development store is billed to your card until you transfer the store to its owner, which removes your card and lists the usage charged so far.
- Wave installed on that store, from the Swell App Store. Without it, a theme's first push stops with "No compatible storefront apps found for this theme."
- `@swell/wave-theme-core`, installed in the theme repo as a dev dependency. `swell theme create` installs it.
- To publish in the Theme Store: a Swell partner account, with payouts set up for a paid theme. See [Publishing themes](https://developers.swell.is/storefronts/selling-themes).
- For a client: a user on the client's store with permission to manage apps and storefronts.
- Optional: an AI coding tool such as Claude Code, Cursor or Codex. See Using AI.

## Theme repo

A theme repo holds the theme's own files and the package it builds on:

```txt
swell.json        the theme app: type "theme", theme.storefront.app "wave", a semver version
package.json      devDependencies: { "@swell/wave-theme-core": "^1.0.0" }
theme/            the theme's own files only
assets/           icon and preview images
DESCRIPTION.md    the Theme Store listing
app/              build output from swell theme build, pushed with swell app push
```

`theme/` never holds a copy of a core file. The build copies `swell.json`, `assets/`, `DESCRIPTION.md`, `.gitignore` and `.swellrc` into the theme app; other top-level files, such as `package.json`, `README.md` and notes, stay out of it. `app/` can be committed or git-ignored.

### File layout

| Path | What it holds |
| --- | --- |
| theme/sections/<type>.tsx | A section: its editor fields and its React component. |
| theme/blocks/<type>.tsx | A block that sections can hold. |
| theme/templates/<page>.json | A page type's sections, with their settings and blocks. |
| theme/groups/<id>.json | A section group. header.json and footer.json replace the core's; top, bottom and sidebar groups are optional. |
| theme/config/settings.json | Design tokens and web fonts. |
| theme/config/settings_content.json | The theme's own global settings, shown in Wave's Theme tab. Optional. |
| theme/config/language.json | Store text: only the new keys the theme's own sections use. |
| theme/config/editor.json | Menu areas: how many levels and links each menu takes. Optional. |
| theme/layout.tsx | A wrapper around every storefront page. Optional. |

`theme/config/version.json` records the theme version a storefront's files came from. The build writes it from `swell.json`; a theme never ships its own.

### Page types

Every page type Wave serves must resolve to a template, from the theme or the core: `home`, `product`, `collection` (a category, and the all-products list at /products), `categories`, `search`, `page` (content pages), `blog`, `blog-post`, `policy`, `cart`, `account`, `account-login` and `not-found`. The core has templates for every page type except `home`, `product` and `collection`, so a theme supplies those three.

A product, category, content page or blog post can use an alternate template named `<base>.<name>.json`, such as `product.bundle.json` or `page.about.json`. The name is lowercase letters, digits and single hyphens, at most 48 characters. Merchants choose it with the record's Template setting in the dashboard.

## Build a theme

**1. Set up the repo**

Create the theme from the Tide starter:

```sh
swell theme create ocean-breeze
cd ocean-breeze
```

This makes a folder named exactly as you typed the name, with the starter's files, writes the theme's `id` and `name` to `swell.json`, and installs `@swell/wave-theme-core` from npm as a dev dependency. The folder must be new or empty, so use a hyphenated name such as `ocean-breeze` rather than one with spaces. The id is the name in lowercase with underscores (`ocean_breeze`), and a name written like an id becomes the title-cased name, Ocean Breeze.

`--from tide` chooses the starter: Tide is the only one, and the default. `--core <dir>` links a local copy of the package instead of installing it from npm, and `-y` skips the prompt for a name.

The starter is a copy of Tide's own files: its sections, blocks, templates, design settings and listing copy, with a `README.md` and `AGENTS.md`. Rename, restyle or replace them. A theme you sell must be substantially your own (see [Publishing themes](https://developers.swell.is/storefronts/selling-themes)).

To start without the starter, create the folder with `swell.json` and install the package:

```sh
npm init -y
npm i -D @swell/wave-theme-core
```

Then add `theme/templates/home.json`, `product.json` and `collection.json`, and the design in `theme/config/settings.json`. Every other page type uses the core's template until you add your own.

**2. Write the theme**

Write your own sections and blocks, lay out your templates and set your design tokens. Use the core's sections as they are, and restyle them through tokens and theme settings. The reference below covers each file.

**3. Check**

```sh
swell theme check
```

This runs the build's checks without writing anything. Each problem prints as `file: message (rule)`, then the fix. Errors come first, then warnings, which are marked `warning`:

```txt
theme/sections/header.tsx: overrides core code (header is a core section or block) (core_override)
  Add a section with its own name built from ui-kit pieces, or ask Swell for an option on the core one

warning theme/config/settings.json: is missing, so the theme uses Wave's default colors, fonts and spacing (no_settings)
  Add theme/config/settings.json with your theme's design: colors, fonts and spacing (see AGENTS.md)
```

An error refuses the build. A warning doesn't, but fix it before you list the theme. The command exits with code 1 when the theme has an error, and with code 0 when it has only warnings.

`--json` prints the problems as JSON for tools, each with its `level`: `error` or `warning`. `--core <dir>` uses a local copy of the package instead of the installed one.

**4. Build**

```sh
swell theme build
```

This writes the assembled theme app to `app/`, or to the folder given with `--out`. Nothing is written when the theme has errors; warnings don't stop the build. The build also writes a manifest, `.theme-build.json`, and refuses to overwrite files in the output folder that changed since the last build, so never edit `app/`: change `theme/` and build again.

**5. Push and preview**

```sh
cd app
swell app push
```

This pushes the theme app to the store you're logged in to, without the build manifest. The first push creates one storefront for the theme in that store and prints its preview link. Wave must be installed on the store first. The CLI remembers that storefront for the folder, so push from the same folder each time. Open the storefront in the Wave editor to see and edit it the way a merchant will.

After the first push, copy `app/.swellrc` to the theme folder (`cp app/.swellrc .`). It holds the theme app's id, and each build carries it into `app/`, so later pushes and fresh clones update the same theme.

To publish the theme, see [Publishing themes](https://developers.swell.is/storefronts/selling-themes). To hand it to one client, see Building for a client.

### Swell's free themes

Swell's free Wave themes are public on GitHub, so you can read how a finished theme is built. Tide is also the starter that `swell theme create` copies.

- [Tide](https://github.com/swellstores/tide-theme): simple, clean and white, and the starting point for building your own.
- [Marram](https://github.com/swellstores/marram-theme): minimal and airy, with light type and room around every product.
- [Mooring](https://github.com/swellstores/mooring-theme): classic and warm, with serif type and photos in picture frames.
- [Estuary](https://github.com/swellstores/estuary-theme): image-led, with large photographs carrying every page.
- [Spinnaker](https://github.com/swellstores/spinnaker-theme): bold and playful, with big type on bright blocks of color.

## The core package

`@swell/wave-theme-core` holds the core and the checks every Wave theme passes:

- `theme/`: the core's sections, blocks, templates, groups, Store text and menu areas.
- `types/ui-kit.d.ts`: types for ui-kit, the only import a section has besides `react`.
- `AGENTS.md`: the theme rules for AI coding tools, with every rule the check refuses and its fix.
- `build` and `check`: the build and its checks, as plain JavaScript modules that run on Node.js 18 or later.
- `starter/tide/`: the Tide starter that `swell theme create` copies. To copy it by hand, rename its `gitignore` to `.gitignore`, run `npm install`, and set `id` and `name` in `swell.json`.

`swell theme check` and `swell theme build` load the package from the theme's `node_modules`. You can also call it from your own scripts:

```typescript
import { build, check, coreDir, version } from '@swell/wave-theme-core';

const problems = await check({ themeDir: '.' });
const { files } = await build({ themeDir: '.', outDir: 'app' }); // writes app/ only when there are no errors

// A problem: { file: 'theme/sections/hero.tsx', rule: 'core_override', message: '...', fix: '...', level: 'error' }
```

`check` and `build` return a list of problems, errors first, then warnings. Each has the `file`, a stable `rule` id, a plain `message`, the `fix` and a `level`: `error` stops the build, and `warning` doesn't. A problem without a `level` counts as an error. `coreDir` defaults to the package's own `theme/` folder, and `version` is the core version.

### Versions

The package follows semver. A patch or minor release never removes or renames a core section, block, setting id or Store text key; only a major release can. Depend on a major version, such as `^1.0.0`, so `npm update` brings fixes without breaking the theme.

The package and its files are free under the Swell App License. See [Licenses](https://developers.swell.is/apps/licenses).

### Typechecking

To typecheck sections against ui-kit, add `@types/react` and a `tsconfig.json`:

**tsconfig.json**

```json
{
  "compilerOptions": {
    "strict": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "module": "esnext",
    "moduleResolution": "bundler",
    "target": "esnext",
    "lib": ["esnext", "dom", "dom.iterable"],
    "skipLibCheck": true
  },
  "include": ["theme/**/*.tsx", "node_modules/@swell/wave-theme-core/types/ui-kit.d.ts"]
}
```

### Core sections and blocks

The core has these sections, blocks and templates. Use them in your templates, and never write a section or block of the same type (`core_override`):

- Sections: `account_view`, `announcement`, `app_form`, `app_page`, `blog_header`, `cart_added`, `cart_drawer_head`, `cart_items`, `cart_summary`, `collection_filters`, `collection_header`, `collection_list`, `contact_details`, `contact_form`, `cookie_banner`, `email_signup`, `faq`, `footer`, `header`, `login_form`, `not_found`, `page_content`, `password_form`, `policy_text`, `post_body`, `post_list`, `product_carousel`, `product_details`, `product_grid`, `search_results`, `search_suggest`, `slideshow` and `store_access`.
- Blocks: `add_to_cart`, `bundle_items`, `collapsible_row`, `collection_card`, `hotspot`, `link_column`, `nav_link`, `pairs_with`, `product_addons`, `product_breadcrumbs`, `product_card`, `product_description`, `product_price`, `product_quantity`, `product_rating`, `product_specs`, `product_stock`, `product_title`, `promises`, `purchase_options`, `slide`, `text`, `upsell_product` and `variant_picker`.
- Templates: `account`, `account-login`, `app`, `blog`, `blog-post`, `cart`, `categories`, `not-found`, `page`, `page.contact`, `policy`, `search` and `store-access`. `page.contact` is the Contact page's layout, and `app` is the layout for app pages. The core has no `password` template and none of the overlay templates: a theme adds those itself (see Password page and [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui)).

Core sections change only through tokens and theme settings. For a layout they don't have, write a section of your own from ui-kit. A product page with a large price box, for example, uses `ProductForm`, which keeps options, purchase options, quantity and add to cart working, with `Price`, which shows a sale price next to the full price. Deal tiles are a section with a product list field, showing `ProductCard` or tiles of your own built from `Price`. Section code doesn't run in the shopper's browser, so interactive parts come from ui-kit's own components or from an app's embed blocks.

The core `header` has a `layout` of `left`, `centered` or `split` (logo on the left, menu in the center), `cart_link` (`page` or `drawer`: what the cart icon opens) and `load_bar` (`standard` or `line`). The core `product_details` has `image_position` (`left`, `right`), `gallery` (`thumbnails below`, `thumbnails beside`, `stacked grid`), `aspect` (`natural`, `square`, `portrait`), `fit` (`cover`, `contain`), `zoom` (`off`, `on hover`, `on click`), `sticky` (`photos`, `details`, `neither`) and `split` (`photos wider`, `photos much wider`, `even`, `details wider`).

## Sections

A section is a TSX module at `theme/sections/<type>.tsx`. It exports its editor fields as a static `schema` and its markup as the default export. The file name is the section's type: lowercase letters, digits and underscores, starting with a letter, at most 40 characters. Name a type by what it does (`lookbook`, `size_guide`), never by a theme or product.

**theme/sections/stats.tsx**

```typescript
import { Container, Eyebrow, sectionColours } from 'ui-kit';

export const schema = {
  label: 'Stats',
  fields: [
    { id: 'eyebrow', type: 'text', label: 'Eyebrow' },
    {
      id: 'items', type: 'list', label: 'Figures', max: 4,
      item: [
        { id: 'value', type: 'text', label: 'Figure' },
        { id: 'label', type: 'text', label: 'Label' },
      ],
      default: [],
    },
    { id: 'background_colour', type: 'color', label: 'Background colour' },
    { id: 'text_colour', type: 'color', label: 'Text colour' },
    { id: 'accent_colour', type: 'color', label: 'Accent colour' },
  ],
} as const;

type Props = { eyebrow?: string; items?: { value?: string; label?: string }[]; background_colour?: string; text_colour?: string; accent_colour?: string; };

// The merchant's own figures. A new section has none and shows nothing until the merchant writes them.
export default function Stats({ eyebrow, items = [], ...colours }: Props) {
  const shown = items.filter((item) => item && (item.value || item.label));
  if (!shown.length) return null;
  return (
    <section style={{ padding: 'var(--uk-section-sm) 0', ...sectionColours(colours) }}>
      <Container>
        {eyebrow ? <Eyebrow>{eyebrow}</Eyebrow> : null}
        <dl style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 150px), 1fr))', gap: 'var(--uk-space-6)', margin: 'var(--uk-space-2) 0 0' }}>
          {shown.map((item, i) => (
            <div key={i} style={{ paddingTop: 22, borderTop: '1px solid var(--uk-color-line-strong)' }}>
              <dt style={{ fontFamily: 'var(--uk-font-heading)', fontSize: 'var(--uk-heading-lg)', fontWeight: 600, lineHeight: 1, color: 'var(--uk-color-accent)' }}>{item.value}</dt>
              <dd style={{ margin: '12px 0 0', fontSize: 'var(--uk-text-sm)', color: 'var(--uk-color-text-muted)' }}>{item.label}</dd>
            </div>
          ))}
        </dl>
      </Container>
    </section>
  );
}
```

The component gets each field's value as a prop with the field's id, plus the reserved props `site` and `t` (see Section props and store data). A field with no value is missing or null, so code must handle undefined and empty values. A section with nothing to show returns `null`.

### Field types

| Type | Value |
| --- | --- |
| text | One line of text, up to 10,000 characters. |
| textarea | Longer text, up to 10,000 characters. |
| url | A link: a path on the storefront or an absolute URL, up to 2,048 characters. |
| image | An image object {url, alt, width, height, focal} on Swell's file hosts. focal is {x, y} from 0 to 1. |
| select | One of the field's options. |
| color | A hex color such as #2f5d46: a color of this section or block, not the store's palette. |
| list | Repeatable items, each an object with the fields listed in item. |

Fields can also read store data: products, categories, menus, content and the shopper's cart or account. See Data fields.

### Schema keys and limits

- `label`: the section's name in the editor, 1 to 80 characters. Required.
- `fields`: at most 40 fields, not counting retired ones, and 80 with them.
- `blocks`: the block types the section holds (see Blocks).
- `icon`: a name from the editor's icon set, lowercase letters, digits and hyphens.
- `retired: true`: the section still renders and saves, but the editor no longer offers it.

Each field takes these keys:

- `id`: letters, digits and underscores, starting with a letter, at most 40 characters, unique in the schema. `key`, `ref`, `blocks`, `site` and `t` are reserved.
- `type`: a field type or a data field type.
- `label`: at most 80 characters.
- `default`: the value a new instance starts with. It must be a valid value for the field.
- `options`: a select's choices, 1 to 50 strings of at most 80 characters.
- `item`, `min` and `max`: a list's item fields and its item count. Item fields use the scalar types only: no lists and no data fields. `max` defaults to 12 and can be at most 50.
- A list field's `default` applies only when a merchant adds the section in the editor. Templates set list props themselves.
- `max`: the most items a `product_list`, `collection_list` or `blog_posts` field shows.
- `filters: true`: on a `product_list` field, the section shows its list's filters.
- `retired: true`: keeps a field you no longer use readable in saved templates. A retired field is top-level and has no default.
- `fill: true`: shows the field's default where a saved instance has no value. Use it for a scalar field added in a later version; it needs a default.

### What section code can use

- Imports come only from `react` and `ui-kit`. From `react`, only the named imports `Fragment`, `useId`, `useMemo` and `Children`. Types can be imported with `import type`.
- No event handler props (`onClick`), no browser or network globals (`window`, `document`, `fetch`, `setTimeout` and the like), no dynamic `import()` and no `dangerouslySetInnerHTML`.
- Nothing moves by itself: no autoplaying slides, tickers, marquees or looping animations. Every word and image is in the page with no script and with reduced motion on. For slides, use ui-kit's `Carousel` (see [Carousels](https://developers.swell.is/storefronts/wave-app#carousels)).
- Elements are the standard HTML content elements and a subset of SVG. `script`, `iframe`, `style`, `link`, `meta`, `object`, `embed`, `template`, `dialog` and SVG `use` are refused.
- `style` is an object literal. Use the design tokens (`var(--uk-color-accent)`) or `sectionColours` for colors.
- JSX text, and string attributes such as `alt`, `title` and `placeholder`, of more than three words are refused. Shopper-facing words come from fields or Store text.
- Images and other loaded resources must be on `cdn.swell.store`, `cdn.schema.io` or `fonts.gstatic.com`. Draw artwork as inline SVG. A form's `action` is a static path on the storefront.
- Attributes starting with `data-section`, `data-block`, `data-app-` and `data-site-cart` are reserved for the editor and ui-kit.
- TypeScript enums, namespaces and `declare` are refused.
- A module is at most 64 KB.

### Section styles

A section can export one static stylesheet as `styles`, for what inline styles can't express: hover and focus states, media and container queries, keyframes and reduced motion. Wave scopes it to the section's wrapper and adds it once to each page that shows the section.

```typescript
export const styles = `
& .tile { transition: transform .2s; }
& .tile:hover { transform: translateY(-2px); }
& .tile:focus-visible { outline: 2px solid var(--uk-color-accent); }
@media (max-width: 749px) { & .tile-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { & .tile { transition: none; } }
`;
```

- The value is a string or a template literal with no `${}` and no backslashes, at most 8 KB.
- Inline styles win over `styles`, so a rule for a property the element already sets inline never applies.
- Every selector starts with `&` (the section's wrapper) once, isn't followed directly by `+` or `~`, and never names `:root`, `html` or `body`. Rules can't be nested.
- The at-rules are `@media`, `@container`, `@supports` and `@keyframes`. Keyframe names get the section type as a prefix.
- Colors only through `var()`: no hex, `rgb()`, `hsl()` or named colors. `transparent` and `currentColor` are allowed.
- No `@import`; `url()` only to the image and font hosts.
- `position: fixed` only in sections of the header group, and in a cookie banner of your own markup (see [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui)). A header that stays in view while shoppers scroll uses it.
- On each template, its own section types' styles are at most 64 KB together, and the styles of the section groups it shows, such as the header and footer, are at most 32 KB, counted apart. `swell theme check` refuses a theme over either. These checks, `page_styles` and `group_styles`, come with `@swell/wave-theme-core` 1.1.0.
- A section's `styles` can restyle the pieces Wave draws inside it, such as search suggestions and the line being added to the cart, through the names in [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui).

### Prop types

Type each prop by what its setting holds. These patterns typecheck against ui-kit's types:

- Set CSS variables inline as plain style keys, `style={{ '--cols': columns }}`, and read them in `styles` (`grid-template-columns: repeat(var(--cols), 1fr)`). ui-kit's types allow any `--name` in `style`, so no cast is needed.
- Type an icon setting as `IconName`, so `<Icon name={icon} />` checks.
- An image setting is `{ url, alt?, width?, height? }`. Pass it with a fallback alt, `image={{ ...photo, alt: photo.alt ?? '' }}`, since ui-kit's `ImageData` needs `alt`.
- Store data types such as `ProductData`, `CollectionData` and `ProductFilter` come from `ui-kit`. Derive a part of one rather than retyping it, such as `ProductData['tiers'][number]` for a quantity tier.

**theme/sections/highlights.tsx**

```typescript
import { Container, Grid, Icon, Image } from 'ui-kit';
import type { IconName, ProductData } from 'ui-kit';

type Photo = { url: string; alt?: string; width?: number; height?: number };
type Tier = ProductData['tiers'][number];

type Props = { columns?: number; icon?: IconName; photo?: Photo; product?: ProductData | null };

export default function Highlights({ columns = 3, icon, photo, product }: Props) {
  const tiers: Tier[] = product?.tiers ?? [];
  return (
    <section style={{ '--cols': columns }}>
      <Container>
        {icon ? <Icon name={icon} /> : null}
        {photo ? <Image image={{ ...photo, alt: photo.alt ?? '' }} /> : null}
        <Grid columns={columns}>
          {tiers.map((tier) => <p key={tier.min}>{tier.min}+</p>)}
        </Grid>
      </Container>
    </section>
  );
}
```

## Blocks

A block is a smaller module that a section holds, such as a card, a link column or a testimonial. Merchants add, move, hide and edit blocks inside the section. A block type is a module at `theme/blocks/<type>.tsx` with a static `schema` (`label` and `fields`, with the section field rules) and a default component. Blocks can't hold blocks.

**theme/blocks/testimonial.tsx**

```typescript
import { Icon } from 'ui-kit';

export const schema = {
  label: 'Testimonial',
  fields: [
    { id: 'quote', type: 'textarea', label: 'Quote' },
    { id: 'author', type: 'text', label: 'Name' },
    { id: 'detail', type: 'text', label: 'Detail' },
    { id: 'rating', type: 'select', label: 'Stars', options: ['none', '5', '4', '3'], default: 'none' },
  ],
} as const;

type Props = { quote?: string; author?: string; detail?: string; rating?: string };

// A quote the merchant adds, with stars only when the merchant chose some.
export default function Testimonial({ quote, author, detail, rating }: Props) {
  if (!quote) return null;
  const stars = Math.max(0, Math.min(5, parseInt(rating ?? '', 10) || 0));
  return (
    <figure className="uk-card" style={{ display: 'flex', flexDirection: 'column', gap: 18, height: '100%', margin: 0 }}>
      {stars ? (
        <div style={{ display: 'flex', gap: 3, color: 'var(--uk-color-highlight)' }}>
          {Array.from({ length: stars }, (_, i) => <Icon key={i} name="star" size={17} />)}
        </div>
      ) : null}
      <blockquote style={{ margin: 0, fontFamily: 'var(--uk-font-heading)', fontSize: 'var(--uk-text-lg)' }}>“{quote}”</blockquote>
      {author ? <figcaption style={{ fontSize: 'var(--uk-text-sm)' }}>{author}{detail ? `, ${detail}` : ''}</figcaption> : null}
    </figure>
  );
}
```

A section opts in with `schema.blocks`:

**theme/sections/testimonials.tsx**

```typescript
import type { ReactElement } from 'react';
import { Container, Grid, Heading } from 'ui-kit';

export const schema = {
  label: 'Testimonials',
  fields: [
    { id: 'heading', type: 'text', label: 'Heading' },
  ],
  blocks: {
    types: ['testimonial'],
    max: 6,
  },
} as const;

export default function Testimonials({ heading, blocks }: { heading?: string; blocks: ReactElement[] }) {
  if (!blocks.length) return null;
  return (
    <section className="uk-if-blocks">
      <Container>
        {heading ? <Heading>{heading}</Heading> : null}
        <Grid columns={3}>{blocks}</Grid>
      </Container>
    </section>
  );
}
```

- `types`: 1 to 20 block types the section accepts.
- `max`: the most blocks an instance holds, 1 to 50. Defaults to 12.
- `default`: the blocks a new instance starts with, as `{type, props}` entries, without ids.
- The section gets `blocks`: one slot element per visible block, in order. Place them where the blocks go. The section never sees a block's props or content.
- Don't place a slot inside `p`, `a`, `button`, a heading, a table or a `select`: the HTML parser would move it.
- The class `uk-if-blocks` on the section's root hides the section while none of its blocks renders anything.
- Each block renders on its own with its fields, `site` and `t`.
- A block has no `styles` export: only a section's is applied. A block styles itself inline and with ui-kit's classes, such as `uk-disclosure`, `uk-field` and `uk-button`, or its section's `styles` name the block's classes.

## ui-kit

`ui-kit` is the component library Wave provides to every section, block and layout. Its components render accessible markup styled by Wave's stylesheet, and their forms and links work before any script loads. Only the exports listed here are stable. The `ui-kit/internal/…` modules in `types/ui-kit.d.ts` only describe store data, and sections never import them.

- **Layout and type**: `Container`, `Section`, `Grid`, `Card`, `Heading`, `Text`, `Eyebrow`, `Badge`, `Button`, `Icon`, `Image`, `RichText`, `DateText`, and `Carousel` (see [Carousels](https://developers.swell.is/storefronts/wave-app#carousels)).
- **Colors**: `sectionColours`, which turns a section's `background_colour`, `text_colour` and `accent_colour` fields into styles that keep readable contrast.
- **Products**: `ProductCard`, `Price`, `ProductForm` (options, purchase options, quantity, stock states and add to cart), `QuickAdd`, `SellList`, `SwatchDot`, `SubscribeSwitch`, `ShoppableImage`, `Hotspot`.
- `QuickAdd` labels can carry the price: when `labels.add` or `labels.choose` holds `{price}`, the button shows the product's price there, so `labels={{ add: 'Add to cart - {price}' }}` reads "Add to cart - $110". `money` formats the amount, and without it the store's format is used. When the product has no price or prices are hidden, the `{price}` part and a dash before it are left out. The core sections use Store text `product.quick_add` for the label, so a merchant can add `{price}` there.
- **Navigation and lists**: `NavMenu`, `Menu`, `Breadcrumbs`, `Pagination`, `SortSelect`, `FilterForm`, `ActiveFilters`, `SearchBox`, `LocalizationForm`.
- **Cart**: `CartLink`, `CartAmount`, `CartQuantity`, `CartTotals`, `CouponForm`, `CartNote`, `PoNumber`, `PaymentIcons`.
- **Account and sign-in**: `AccountBody`, `AccountNav`, `OrderHistory`, `OrderDetail`, `OrderLines`, `BuyAgain`, `AddressBook`, `SubscriptionList`, `SubscriptionDetail`, `StatusBadge`, `AuthForms`, `SignInForm`, `SignUpForm`.
- **Forms and messages**: `Field`, `NewsletterFields`, `Notice`, and `AgeGate`, a prompt that asks shoppers to confirm their age, which a theme renders from its layout behind a setting of its own. It's a courtesy prompt, not age verification.
- **Apps**: `AppEmbed`, which places an installed app's storefront widget, such as live chat or a booking calendar, and `AppAction`, which posts a form to an app's action (see [Storefront extensions](https://developers.swell.is/storefronts/storefront-extensions)). The core `app_form` section shows the form a merchant picks in its `app_action` field.
- **Helpers**: `safeUrl`, `telHref`, `periodText`, `pricesHiddenFor`, `SignInForPrices`, `inGroups`.
- **Types**: `ProductData`, `CollectionData`, `ProductList`, `MenuData`, `SiteInfo`, `Translate`, `IconName`, `OrderList`, `OrderSummary`, `SubscriptionSummary`, `AppFlash`, `PricesHidden`, the `*Labels` types such as `AgeGateLabels`, and the other data types, with `import type`.

Wave's stylesheet defines the design tokens every section shares as CSS custom properties: `--uk-color-*`, `--uk-font-*`, `--uk-text-*`, `--uk-heading-*`, `--uk-space-*`, `--uk-section-*` and `--uk-radius-*`. Use them rather than literal values, so the Theme tab and the agent can restyle the whole store.

### Carousels

Section code never runs in the shopper's browser, so a section can't move slides or answer a click on its own: the most its markup can do is a CSS scroll-snap row. For slides, use ui-kit's `Carousel`. Wave's platform script drives it, as it drives the cart drawer and the variant picker. The core `slideshow` and `product_carousel` sections are built on it.

```typescript
import type { ReactElement } from 'react';
import type { Translate } from 'ui-kit';
import { Carousel, carouselLabels, Container, Heading } from 'ui-kit';

export const schema = {
  label: 'Lookbook',
  fields: [
    { id: 'heading', type: 'text', label: 'Heading' },
    { id: 'autoplay', type: 'select', label: 'Change slides by themselves, every (seconds)', options: ['off', '5', '8'], default: 'off' },
  ],
  blocks: { types: ['look'], max: 12 },
} as const;

export default function Lookbook({ t, heading, autoplay, blocks }: { t: Translate; heading?: string; autoplay?: string; blocks: ReactElement[] }) {
  if (!blocks.length) return null;
  return (
    <section style={{ padding: 'var(--uk-section-sm) 0' }}>
      <Container>
        {heading ? <Heading>{heading}</Heading> : null}
        <Carousel label={heading} labels={carouselLabels(t)} perView={{ phone: 1, tablet: 2, desktop: 3 }} peek autoplay={Number(autoplay) || undefined}>
          {blocks}
        </Carousel>
      </Container>
    </section>
  );
}
```

- **Slides:** each child is one slide, so pass `blocks` straight in, or your own elements, each with a `key`. A block's root fills its slide.
- **With no script,** every slide is in the page on a scroll-snap track. Shoppers swipe and scroll it, keyboard users reach each slide's links or use the arrow keys on the track, and search engines and screen readers read every slide. The carousel is a region named by `label`, or by Store text `carousel.label`, and each slide is announced by its place, such as "2 of 8".
- **The script adds** the previous and next arrows, the dots (one per view) and, with `autoplay`, a pause button. They are 44 px buttons, in the page from the start and hidden until the track can scroll, so nothing shifts.
- **Props:** `perView` is the slides per view, a number or `{ phone, tablet, desktop }` (up to 560 px, up to 900 px, and wider; one left out takes the next smaller one's). `peek` shows the next slide's edge. `loop` takes the arrows round from the last slide to the first. `autoplay` is the seconds between slides, at least 3. `ratio` is each slide's shape, such as `"16 / 9"`. `labels` takes `carouselLabels(t)`, from the Store text area `carousel`.
- **Autoplay is the merchant's choice:** make it a setting, off by default. It never starts with reduced motion on, pauses while the pointer or the keyboard focus is in the carousel and while the tab is hidden, and stops once the shopper uses an arrow, a dot or an arrow key. The pause button is there whenever it can play.
- **No layout shift:** give slides a fixed shape with `ratio`, `--uk-carousel-height` on an element around it, or the media's own `aspect-ratio`. Load only the first slide's image at once: a block reads its `section.index` (`<Image priority={section?.index === 0} />`), and the script loads the next view's images just before they show. A page without a carousel loads none of the script.
- **Restyle** with your `styles` on the classes `.uk-carousel`, `.uk-carousel-track`, `.uk-carousel-slide`, `.uk-carousel-arrow`, `.uk-carousel-dots`, `.uk-carousel-dot` and `.uk-carousel-play`, and custom properties such as `--uk-carousel-gap`, `--uk-carousel-control-bg` and `--uk-carousel-inset`, the room the arrows take on each side. Keep the buttons at least 24 px, with a visible focus outline. AGENTS.md lists every class and property.
- **In the editor,** the canvas runs no platform script: it shows the track with its arrows and dots, and selecting a slide's block scrolls the track to it.

Use the core sections before writing your own: `slideshow` shows one slide at a time, from `slide` blocks with an image, a heading, text and buttons, and `product_carousel` shows the store's products as cards, 2 to 5 per view. `Carousel`, `slideshow` and `product_carousel` need `@swell/wave-theme-core` 1.1.0 or later, on stores running Wave 1.0.16 or later.

## Section props and store data

Every section gets these props:

- its fields' values, with data fields already resolved to store data;
- `blocks`: its visible blocks as slots, when the section holds blocks;
- `site`: the store context;
- `t`: the reader of Store text.

A block gets its fields, `site`, `t` and `section`: its section's `id`, `type` and `data` (the section's store data by field id), and `index`, the block's place among the section's shown blocks, 0 for the first. Don't name a block field `section`.

### Data fields

A data field stores a reference in the template, and Wave resolves it to data before the section renders:

| Type | Template stores | Section receives |
| --- | --- | --- |
| product | A product slug, or "current" on product pages | ProductData or null |
| collection | A category slug, "all", or "current" on category pages | CollectionData or null |
| product_list | A product query | ProductList |
| collection_list | A category query | CollectionData[] |
| menu | A menu id, such as main_menu | MenuData or null |
| content_page | A content page slug, or "current" on content pages | PageData or null |
| blog | A blog slug, "all", or "current" on blog and blog post pages | BlogData or null |
| blog_post | A post slug, or "current" on blog post pages | PostData or null |
| blog_posts | A post query | PostList |
| policy | refund, privacy, terms, or "current" on policy pages | PolicyData or null |
| cart | "current", on the cart page only | CartData |
| account | "current", on account pages only | AccountView |
| auth | "current", on the sign-in page only | AuthView |
| app_action | {"app": "<app>", "action": "<action>"}, an installed app's form | AppActionData (see Storefront extensions) |

Data fields are top-level fields only, never list items. A `product_list` field can show up to 48 items, and a `collection_list` or `blog_posts` field up to 24; each defaults to 12. The queries take these shapes:

```json
// product_list
{ "from": "collection", "collection": "<slug> | all | current", "sort": "best_selling", "limit": 8 }
{ "from": "products", "products": ["<slug>", "<slug>"] }
{ "from": "related", "product": "current", "limit": 4 }       // also up_sells and cross_sells
{ "from": "cart_cross_sells", "limit": 4 }                      // also cart_products; cart pages
{ "from": "all", "sort": "newest", "limit": 12 }
{ "from": "search", "limit": 24 }                               // search pages

// collection_list
{ "from": "collections", "collections": ["<slug>", "<slug>"] }
{ "from": "top", "limit": 6 }

// blog_posts
{ "from": "blog", "blog": "<slug> | all | current", "limit": 3 }
{ "from": "latest", "limit": 3 }
```

The sorts are `featured`, `best_selling`, `newest`, `price_asc`, `price_desc` and `name`.

Store data is plain JSON built field by field from Swell records: strings are capped, URLs are checked, prices are Swell's guest prices in the page's currency as `Money` (`amount`, `currency`, `formatted`), and descriptions are arrays of `TextBlock`, never HTML. Render them with `RichText`. A product's own page includes its options, variants, the selected variant, attributes, purchase options and subscription plans, bundle items, quantity tiers and primary category; in lists, `variants` is empty.

Data can be missing. A field with nothing to show gets `null`, `[]` or an empty list. A product's `price` is `null` when Swell prices it for customer groups only, and a product may have no variants. The cart, account and sign-in fields carry an `unavailable` flag when Swell can't be read. In the editor, a store without data shows labelled samples, marked `sample: true`.

### The site prop

`site` is the same for every shopper on a public page, so pages can be cached. It holds:

- `site.store`: the store's name, storefront URL, support email and phone, country, currencies, languages, shipping countries, payment method names, the policies that have text, and the account and email opt-in modes. Values are empty or `null` when Swell doesn't have them.
- `site.brand`: the logo, logo width, social links and announcement the merchant sets in the Theme tab.
- `site.page`: the page's `kind`, `path`, canonical `url`, `query` and `title`. `query` is the page's canonical query string, such as `?q=sony` or `?sort=price&page=2`, and is absent when the page reads none. The search term itself is the `query` of the page's search product list.
- `site.year`, `site.currency`, `site.locale` and `site.languages`.
- `site.notice`: a notice code for the page to show, such as the newsletter sign-up's outcome.
- `site.theme_settings`: the theme's own settings (see Theme settings).
- `site.shopper` and `site.prices_hidden`: present only on pages that read the shopper (see Theme settings).

### Store data, not hard-coded content

A theme never types a fact Swell holds. Store names, contact details, prices, years, product and category names, policies and navigation links come from data fields or `site`. The logo, social links and announcement come from `site.brand`.

Headings, labels and marketing copy are section fields, and their defaults are neutral and make no factual claim: "Shop all" and "Sign up to get emails from us." are fine, "Free shipping over $100" and "Since 2009" are not. Never ship reviews, ratings, quotes, figures or people as defaults. A section with no data renders nothing on the live site.

## Templates

A template is a page type's sections, in display order, with each instance's settings and blocks:

**theme/templates/home.json**

```json
{
  "title": "Home",
  "sections": [
    {
      "id": "hero",
      "type": "hero",
      "props": { "cta_label": "Shop all", "cta_href": "/products", "align": "left" }
    },
    {
      "id": "best-sellers",
      "type": "product_grid",
      "props": {
        "heading": "Products",
        "link_label": "Shop all",
        "link_href": "/products",
        "products": { "from": "all", "sort": "best_selling", "limit": 4 }
      }
    },
    {
      "id": "reviews",
      "type": "testimonials",
      "props": { "heading": "What customers say" },
      "blocks": [
        { "id": "first", "type": "testimonial", "props": {} }
      ]
    }
  ]
}
```

- `title`: the template's name, at most 200 characters.
- `sections`: at most 20 instances, each `{id, type, props, blocks?, hidden?}`. Ids are lowercase letters, digits, hyphens and underscores, at most 40 characters, unique in the template.
- `props`: every key must be a field of the section's type, with a valid value. A `current` data value is accepted only on its own page type.
- `blocks`: `{id, type, props, hidden?}` entries in display order, ids unique within the section, at most 80 blocks in the template.
- `hidden: true`: the instance stays in the template but doesn't render.
- `hidden_groups`: ids of top, bottom or sidebar groups this page leaves out.
- A template is at most 64 KB, not counting translations a merchant adds.
- The header and footer come from their groups. A template never holds a section of a type the header or footer group holds, and doesn't use a `groups` key.
- A template section's `id` can't be the id of a section in a group, such as `header`, `footer` or `announcement`. The group's section would be left out of that page.

### App blocks in a template

A template or section group can place an installed app's block as a section of type `app_block`. The check accepts the type and checks its props, and the store shows the block once the app is installed. Name the app in `swell.json` `theme.apps` if the theme needs it (see Required apps).

```json
{
  "id": "downloads",
  "type": "app_block",
  "props": { "app": "<app id>", "block": "<block id>", "settings": {} }
}
```

An app can also say where a block usually goes, by page type and section or block type, and Wave offers merchants a one-click Add there (see [Storefront extensions](https://developers.swell.is/storefronts/storefront-extensions)). Those positions name section and block types, so keep the core's types for the same jobs, such as `account_view`, `product_details`, `cart_items`, `cart_summary` and `product_title`, rather than renaming them. When a page lacks the section type a position names, the block goes at the end of the page's own sections.

### Pages the theme links to

A page the theme itself links to, such as a quick order form or an application form, is a page layout `theme/templates/page.<name>.json` with `"page": { "standalone": true }`. It answers `/pages/<name>` on a fresh install, before the merchant makes any page, until a content page takes that address. Never link to a `/pages/` address that nothing answers: Publish warns about it.

### Password page

A merchant can protect a storefront with a password in Swell, with a message for the page. While it's on, Swell keeps every visitor who hasn't entered it on one page, `/password`, and Wave renders that page from the theme. It is the store's setting, and the theme only styles the page.

```json
{
  "title": "Password",
  "hidden_groups": ["header", "footer"],
  "sections": [
    {
      "id": "password",
      "type": "password_form",
      "props": { "text": "We're getting everything ready. Enter the password to look around." }
    }
  ]
}
```

- The template is `theme/templates/password.json`. Name `password` in `theme/config/editor.json` `templates` when the theme declares its templates. Without the file, shoppers get Wave's plain page: the core `password_form` section alone, in the theme's colors and fonts.
- Hide the header and footer groups and put no links to the store on the page. A visitor kept out can open nothing else on the store, so menus, search and the cart would only lead back here. Images on the store's CDN are fine.
- The core `password_form` section shows the store's logo, a heading, the store's message (its own `text` when the store has none), the password form, an optional email sign-up (`signup`) and a "Store owner? Log in" link (`owner`). Its `look` is `card` or `plain`.
- A section of your own reads `site.password`: `message`, `error` (`wrong`, `limit` or null), `return_to` and `admin_url`. Render ui-kit's `PasswordForm` for the form. It posts to `/password`, works without scripts and says when a try failed. Never build your own password form, and never put one on another page.
- The words are Store text area `password`. The sign-up uses area `newsletter`.
- Wave renders the page for each request, never cached and with noindex.

```tsx
<PasswordForm
  site={site}
  labels={{ password: t('password.label'), enter: t('password.enter'), wrong: t('password.wrong'), limit: t('password.limit') }}
/>
```

### Overlay templates

Four optional templates replace pieces Wave draws over other pages: `cart-drawer.json`, `cookie-banner.json`, `search-suggest.json` and `cart-added.json`. See [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui).

### Sign in, accounts and cart

Every Wave theme gives shoppers sign in, account creation, password reset, the account pages and the cart. Wave serves the routes and Swell sends the recovery email. The theme only renders the forms.

- Password reset takes two pages: shoppers ask for a link at `/account/recover`, then set a new password from the emailed link, `/account/recover/<key>`. The forms post to `/account/recover` and `/account/reset`.
- Build the sign in, account and reset forms with ui-kit's `AuthForms`, as the core's `login_form` section does. A theme that keeps the core's Sign in template (`account-login`) has them with no work.
- Account pages use ui-kit's `AccountBody`, and the cart page uses the cart components (see ui-kit). Forms of your own must post the same fields to the same routes.
- The words on these pages are Store text, never section settings. The recovery email is Swell's account recovery notification, which the merchant edits in the dashboard.
- If a theme's Sign in, Account or Cart template is missing or can't be read, Wave serves the core's page in its place, inside the theme's layout and header and footer groups. That's a safety net for a template that fails to read or a theme not built with `swell theme build`, not something to rely on: a built theme always has these templates, and themes in the Theme Store ship their own.

## Section groups

A section group holds sections that many pages share. Every theme has exactly one header group and one footer group, and every page shows both. The core's groups hold the announcement and header, and the footer; a theme's own `theme/groups/header.json` or `footer.json` replaces them.

**theme/groups/header.json**

```json
{
  "type": "header",
  "name": "Header",
  "sections": [
    { "id": "announcement", "type": "announcement", "props": {} },
    { "id": "header", "type": "header", "props": { "menu": "main_menu" } }
  ]
}
```

The file name is the group's id: lowercase letters, digits and underscores, starting with a letter, at most 24 characters. A group's `type` is where it goes:

| Type | Placement |
| --- | --- |
| header | The top of every page. |
| top | Under the header. |
| left, right | A sidebar beside the page's own sections on desktop, under them on a phone. |
| bottom | Above the footer. |
| footer | The bottom of every page. |

**theme/groups/shop_sidebar.json**

```json
{
  "type": "left",
  "name": "Shop sidebar",
  "pages": ["collection", "search"],
  "sections": [
    {
      "id": "categories",
      "type": "collection_list",
      "props": { "heading": "Categories", "collections": { "from": "top", "limit": 8 } }
    }
  ]
}
```

- `pages`: for top, bottom, left and right groups, 1 to 40 page types the group shows on. A template base covers its alternates: `product` covers `product.bundle`. Without `pages`, the group shows on every page.
- A page shows at most one group of each type, so two groups of one type whose pages overlap are refused.
- At most 12 group files, each with at most 8 sections and 40 blocks.
- A group has no page of its own, so its sections can't use `current` data values.
- Wave lays out left and right groups in its own grid. A theme layout can place them itself with ui-kit's `GroupSlot` (see [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui)).

## Design settings

`theme/config/settings.json` holds the theme's design: colors, fonts, corner radii and style choices, as values of ui-kit's tokens. Merchants change them in Wave's Theme tab or by asking the agent. Without the file, Wave's default design applies.

**theme/config/settings.json**

```json
{
  "format": 1,
  "tokens": {
    "--uk-color-bg": "#fcfcfb",
    "--uk-color-ink": "#1b1b1a",
    "--uk-color-heading": "#121211",
    "--uk-color-accent": "#1b1b1a",
    "--uk-color-on-accent": "#ffffff",
    "--uk-color-sale": "#a1271c",
    "--uk-font-heading": "'Source Serif 4', Georgia, serif",
    "--uk-font-body": "'Archivo', Arial, sans-serif",
    "--uk-font-heading-weight": 400,
    "--uk-radius-md": 2,
    "--uk-type-scale": "regular",
    "--uk-button-fill": "solid",
    "--uk-card": "flat",
    "--uk-motion": "subtle"
  },
  "fonts": [
    {
      "family": "Archivo",
      "source": "google",
      "weights": [400, 600],
      "faces": [
        { "subset": "latin", "style": "normal", "weight": "400",
          "url": "https://fonts.gstatic.com/s/archivo/v25/k3kPo8UDI-1M0wlSV9XAw6lQkqWY8Q82sLydOxKsv4Rn.woff2",
          "range": "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD" },
        { "subset": "latin", "style": "normal", "weight": "600",
          "url": "https://fonts.gstatic.com/s/archivo/v25/k3kPo8UDI-1M0wlSV9XAw6lQkqWY8Q82sLydOxKsv4Rn.woff2",
          "range": "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD" }
      ]
    }
  ]
}
```

- `format`: `1`.
- `tokens`: Wave's token names only. Colors (`--uk-color-bg`, `--uk-color-surface`, `--uk-color-ink`, `--uk-color-heading`, `--uk-color-accent`, `--uk-color-sale` and the others) are hex. Fonts (`--uk-font-body`, `--uk-font-heading`, `--uk-font-accent`) are font stacks. `--uk-font-heading-weight` is 100 to 900 in hundreds. Radii and `--uk-border-width` are whole pixels.
- `fonts`: up to 3 Google font families, each with 1 to 4 `weights` and 1 to 24 `faces`. A face is `{subset, style, weight, url, range}`: the values of one `@font-face` block in the family's Google Fonts CSS2 stylesheet, such as `https://fonts.googleapis.com/css2?family=Archivo:wght@400;600`. Take `subset` from the comment above the block, such as `latin`, then its `font-style`, its `font-weight` (a range such as `100 900` for a variable font), the woff2 `url` on `fonts.gstatic.com/s/` and its `unicode-range`. A family with a face that breaks a rule is dropped. In the Theme tab, merchants choose two fonts: one for headings and one for body text.
- Shoppers' pages load theme fonts from the storefront's own host with `font-display: optional`: a font that isn't cached yet shows its fallback on the first page a shopper opens, and is used once it's cached. The editor uses `swap`.
- `theme`: values for the theme's own settings. Defaults belong in `settings_content.json`.
- `brand`: the merchant's store name, logo, favicon, social links and announcement, set in the Theme tab.
- The file is at most 16 KB.

Style choices take one option each:

| Token | Options |
| --- | --- |
| --uk-type-scale | regular, compact, large, display |
| --uk-density | regular, tight, airy |
| --uk-width | regular, narrow, wide, full |
| --uk-button-fill | solid, outline, text |
| --uk-button-case | none, upper |
| --uk-heading-case | none, upper |
| --uk-eyebrow | caps, plain, none |
| --uk-card | flat, outline, shadow |
| --uk-art | landscape, shapes, grain, gradient, lines |
| --uk-product-image | portrait, square, landscape, tall |
| --uk-product-text | left, center |
| --uk-motion | none, subtle, lively |

A storefront's `settings.json` holds the merchant's design, so theme updates never change it. A setting added in a later version reads its declared default.

## Theme settings

A theme declares its own global settings in `theme/config/settings_content.json`, in the shape of a Swell app's settings file (see [Settings](https://developers.swell.is/apps/settings)). Each field group becomes a group in Wave's Theme tab. This file is Wave's own and is not Shopify's `settings_schema.json`.

**theme/config/settings_content.json**

```json
{
  "fields": [
    {
      "type": "field_group",
      "label": "Header",
      "fields": [
        { "id": "sticky_header", "label": "Keep the header in view while scrolling", "type": "toggle", "default": true }
      ]
    },
    {
      "type": "field_group",
      "label": "Product cards",
      "description": "How products show in category pages, search results and product lists.",
      "fields": [
        {
          "id": "card_quick_add", "label": "Quick add", "type": "toggle", "default": false,
          "description": "An Add button under each card. A product with options gets a Choose options link instead."
        },
        {
          "id": "card_swatches", "label": "Colour dots", "type": "slider", "default": 0, "min": 0, "max": 8, "increment": 1,
          "description": "How many of a product's colour or material swatches each card shows. 0: none."
        }
      ]
    }
  ]
}
```

The file is `{label?, description?, fields}`. Each `field_group` has a `label`, an optional `description` shown as the group's intro, and `fields`. Fields outside any group form one group named by the file's `label`.

| Type | Value |
| --- | --- |
| toggle (also boolean, checkbox) | true or false |
| select (also dropdown), radio | One of the field's option values |
| text (also short_text) | One line of plain text, up to 500 characters |
| textarea (also long_text) | Plain text, up to 500 characters |
| number | A number within min and max |
| slider | A number from min to max in steps of increment (default 1) |
| color | A hex color |
| url | A path on the storefront or an https address |

- `id`: lowercase letters, digits and underscores, starting with a letter, at most 60 characters, unique.
- `label`: 1 to 80 characters. `default` is required and must be a valid value.
- `description` or `hint`: help text, at most 300 characters. `placeholder`: at most 80 characters.
- `options`: for select and radio, 1 to 50 `{value, label}` entries.
- `min`, `max`, `increment` and `unit`: for number and slider. A slider needs `min` and `max`.
- At most 50 fields in at most 20 groups, and 32 KB.

Sections and blocks read the values from `site.theme_settings`: each setting's default, overlaid with the merchant's value. Wave never reads a setting by name, so the theme decides what each one means.

```typescript
const sticky = site?.theme_settings?.sticky_header !== false;
const swatches = Number(site?.theme_settings?.card_swatches ?? 0);
```

The core's sections read `sticky_header`, `card_quick_add` and `card_swatches` when a theme declares them.

A select or radio marked `"controls": "cart_after_add"` lets merchants choose what an add to cart does: open the cart drawer, go to the cart page or show a notification (see [Wave Theme UI](https://developers.swell.is/storefronts/wave-theme-ui)).

### Settings that read the shopper

A field can declare two rules that Wave evaluates without knowing what the setting means:

- `shopper_unless: "<value>"`: while the setting holds any other value, the theme's pages read the shopper. `site.shopper` then has `signed_in` and `group` (the customer group), and each page renders for that shopper and is never cached.
- `prices_hidden: {when: [values], groups: "<text setting id>"}`: while the setting holds one of the `when` values, prices and add to cart are hidden for shoppers outside the customer groups listed, comma-separated, in the named text setting. Without `groups`, they are hidden for shoppers who aren't signed in. Wave sets `site.prices_hidden` on those pages and leaves prices out of search suggestions; ui-kit's product components and `pricesHiddenFor` follow it. An active rule also makes the pages read the shopper.

Give a setting with either rule a default that keeps pages public and cached, so a new storefront is.

## Store text

Store text is the fixed words shoppers see, such as button labels, cart totals and error messages, kept in one place so merchants can change and translate them. The core's file covers the core sections, in these areas: `cart`, `product`, `collection`, `filter`, `sort`, `search`, `pagination`, `account`, `order_status`, `address`, `login`, `common`, `navigation`, `newsletter`, `contact`, `blog`, `not_found`, `footer`, `errors` and `policy`. A theme's `theme/config/language.json` adds only the keys its own sections use.

**theme/config/language.json**

```json
{
  "$format": 1,
  "size_guide": {
    "$label": "Size guide",
    "$notes": {
      "open": "Link under the size options on a product page",
      "fits": "Fit note above the size table ({size} is filled in)"
    },
    "open": "Size guide",
    "fits": "Fits like a {size}",
    "rows": { "one": "{count} size", "other": "{count} sizes" }
  }
}
```

- Keys are `area.key`. Area and key names are lowercase letters, digits and underscores, starting with a letter, at most 32 characters. Name a key by its job (`cart.subtotal`), not by the section that shows it.
- `$label`: the area's name in the editor. `$notes`: what a key is for, where the words alone don't say where they show.
- A value is plain text of at most 2,000 characters, or plural forms `{zero?, one?, two?, few?, many?, other}`; `other` is required.
- `{name}` placeholders are filled in by the section. A merchant's edit can only use the placeholders of the theme's value.
- A theme adds new areas, or new keys in a core area with their `$notes`. It can't redefine a core key or a core area's `$label`, and it never ships `$locale`, `$src` or `$auto`: those hold the merchant's edits and translations.
- The file is at most 256 KB.

Sections and blocks read Store text with the reserved prop `t`:

```typescript
import type { Translate } from 'ui-kit';

export default function SizeGuide({ t, size }: { t: Translate; size?: string }) {
  const fits = size ? t('size_guide.fits', { size }) : '';
  return (
    <div>
      {t('size_guide.open') ? <a href="#size-guide">{t('size_guide.open')}</a> : null}
      {fits ? <p>{fits}</p> : null}
    </div>
  );
}
```

`t(key, vars)` returns the value in the shopper's language, or `''` when the merchant blanked it, so guard optional words. For a plural, pass `count`. A literal key that isn't in Store text fails the section's check; a key built with a template literal is checked by its fixed prefix, such as `order_status.`.

## Menus

A section shows a menu with a `menu` field, whose value is a menu id, and renders it with `NavMenu`. Wave's storefront has two default menus, `main_menu` and `footer_menu`; merchants edit their links in Wave's menu panel or the dashboard. NavMenu shows up to 3 levels, so a mega menu is a three-level menu whose area lays out columns (see below).

`theme/config/editor.json` describes the menu areas the theme renders, so the menu panel limits each menu to what the theme can show. The core defines `main_menu` (Header, two levels) and `footer_menu` (Footer, in columns). A theme's entries are merged with the core's by id: an entry replaces the core's entry with that id, and a new id adds an area. `menus` is the file's only key.

**theme/config/editor.json**

```json
{
  "menus": [
    {
      "id": "main_menu",
      "label": "Header",
      "max_items": 10,
      "child_items": { "max_items": 16, "child_items": { "max_items": 16, "child_items": false } }
    }
  ]
}
```

- `id`: the menu's id, such as `main_menu`. `label`: its name in the editor, 1 to 120 characters.
- `max_items`: links on this level, 1 to 50.
- `columns`: `true` to lay the level out in columns. `max_columns`: the most columns, 1 to 12.
- `item_types`: the item types this level takes, from `home`, `product_list`, `product`, `category_list`, `category`, `page`, `blog`, `blog_category`, `search`, `url`, `heading` and `column`. Without it, any type.
- `child_items`: the next level's rules, or `false` for none. Menus are at most 3 levels deep.
- At most 50 areas, and 16 KB. Publish copies the areas to the storefront's editor settings.

### Setting up menus by API

To set up a storefront's menus without the editor, such as after importing a store, write its menus config with the Backend API and a secret key: `PUT /:storefronts/{id}/configs/menus`. Get the storefront's id from `GET /:storefronts`, and read the current menus with a `GET` on the same path. Each write replaces the whole list, so send every menu:

```json
{
  "$set": {
    "values": {
      "menus": [
        {
          "id": "main_menu",
          "name": "Main menu",
          "items": [
            { "type": "product", "name": "Shop all" },
            {
              "type": "category", "name": "Audio", "value": "audio",
              "items": [
                { "type": "category", "name": "Headphones", "value": "headphones" },
                { "type": "category", "name": "Speakers", "value": "speakers" }
              ]
            },
            { "type": "url", "name": "Store locator", "value": "/pages/stores" }
          ]
        },
        {
          "id": "footer_menu",
          "name": "Footer",
          "items": [
            {
              "type": "column",
              "items": [
                { "type": "heading", "name": "Help" },
                { "type": "url", "name": "Contact us", "value": "mailto:help@example.com" }
              ]
            }
          ]
        }
      ]
    }
  }
}
```

A menu is `{id, name, items}`, with `main_menu` and `footer_menu` as Wave's defaults. An item is `{type, name, value?, options?, items?}`, at most 3 levels deep and 50 items a level:

- `product` and `category`: `value` is the record's slug. Without a `value`, the item links to all products or all categories.
- `page`, `blog` and `blog_category`: `value` is the record's id.
- `url`: `value` is a root path such as `/pages/stores`, an `https` URL, a `mailto:` link or a `tel:` link. `options.target: "blank"` opens it in a new tab.
- `search`: `value` is the search text, with `options.query: true`.
- `home`, `heading` and `column` take no `value`. A `column` groups footer links and has no name.

Menus written this way show in Wave's menu panel and in the dashboard like any others.

## Layout

`theme/layout.tsx` is an optional module whose default export wraps every storefront page. Its `children` is the page: the header and footer groups, any other groups and the template's sections. It compiles and lints like a section and has no schema.

**theme/layout.tsx**

```typescript
export default function Layout({ settings, children }) {
  const framed = settings.page_frame === true;
  return (
    <div style={framed ? { maxWidth: 1440, margin: '0 auto', borderInline: '1px solid var(--uk-color-line)' } : undefined}>
      {children}
    </div>
  );
}
```

- Props: `site`, `settings` (`site.theme_settings`, `{}` when the theme declares none), `children` and `t`.
- On a page shared by every shopper, the layout must render `children` exactly once. If it fails there, the page shows without it.
- Don't place `children` inside `p`, `a`, `button`, a heading, a table or a `select`.
- On a page that reads the shopper (see Settings that read the shopper), Wave renders the layout first, before any of the page's data. It may render its own content instead of `children`; that HTML is then the page, served with `noindex`, and none of the template's data is read. Let the sign-in page (`site.page.kind` `login`) show its `children`.
- The layout's HTML passes the same checks as a section's.

## Checks

### Wave's checks

Wave checks every theme file when it's written, whether by the editor, the agent or a theme update:

- **Compile and lint**: each section, block and layout parses, passes the code rules in What section code can use, and transpiles.
- Schema: the schema is static and valid: at most 40 fields besides retired ones, labels of at most 80 characters, known field types and keys, valid defaults, block types that exist.
- **Styles**: a section's `styles` export follows the Section styles rules.
- **Render**: each section and block renders in an isolated worker with sample store data, and again with an empty store context and empty data fields. A section with a product field also renders with a bare product that has no variants and no guest price; cart, account and sign-in sections render every state. Code that throws on missing data fails.
- **HTML**: the rendered HTML passes a strict check: allowed elements and attributes only, loaded resources on Swell's hosts, and block slots where the parser leaves them.
- **Templates and groups**: shape and size, section types that exist, every prop a field of its section with a valid value, `current` only on its own page type, and the group placement rules.
- **Config files**: `settings.json`, `settings_content.json`, `language.json` and `editor.json` match their shapes and limits.

`swell theme check` and `swell theme build` run the compile, lint, schema, styles, template and config checks on the assembled theme. The render and HTML checks run in Wave.

### What swell theme check refuses

Each error names one of these rules. `AGENTS.md` in the package lists the same rules, and the warnings below.

| Rule | Refused when | Fix |
| --- | --- | --- |
| swell_json | swell.json is missing, isn't a theme app, or has no semver version. | Set "type": "theme", theme.storefront.app "wave" and a version such as "1.0.0". |
| json | A JSON file doesn't parse, or isn't an object. | Fix the syntax. |
| version_file | The theme has theme/config/version.json. | Remove it. The build writes it from swell.json. |
| core_override | A section or block has the type of a core section or block. | Add a section with its own name, built from ui-kit. |
| type_id | A section or block type doesn't match [a-z][a-z0-9_]*. | Rename the file. |
| custom_id | A type starts with custom_, which is reserved for the agent's sections. | Rename it without the prefix. |
| brand_name | A type contains wave or tide. | Name it by what it does, such as lookbook. |
| core_copy | A file is a byte-for-byte copy of a core section or block. | Use the core one in templates. |
| core_file | A file sits at a core path other than a template, a group, language.json or editor.json. | Remove it. |
| module_path | theme/sections or theme/blocks holds something other than <type>.tsx files. | Rename or move it. |
| settings | settings.json breaks the design settings rules. | Fix the value named. |
| settings_content | settings_content.json isn't a valid settings declaration. | Fix the field named. |
| store_text | language.json breaks Store text's shape, or the file is named translations.json. | Fix the key named, or rename the file to language.json. |
| store_text_core_key | language.json sets a core key or a core area's $label. | Use a new key. |
| editor_key | editor.json has a key other than menus. | Remove it. |
| menus | A menu area has no id, or the merged menus break the menu area rules. | Fix the menu area. |
| page_type_template | A page type has no template in the theme or the core. | Add theme/templates/<page>.json. |
| groups | There isn't exactly one header and one footer group, or a template drops or holds a copy of one. | See Section groups. |
| missing_section | A template or group names a section type that no section file defines. | Add the section, or fix the type. |
| lint | A section, block or layout breaks Wave's code rules. | Fix the lines shown. |
| compile | A module doesn't parse or compile, or is over 64 KB. | Fix the lines shown. |
| schema | Wave refuses a schema. | Fix the schema. |
| styles | A styles export breaks a Section styles rule. | Fix the rule shown. |
| page_styles | A template's own section types bring more than 64 KB of styles together. | Use fewer section types with styles, or smaller styles. |
| group_styles | The section groups a page shows bring more than 32 KB of styles together, or they do with the overlay templates' sections. | Use fewer section types with styles in the groups or the overlay templates, or smaller styles. |
| template | Wave refuses a template: unknown types, props that don't match a schema, or bad data queries. Also an overlay template that breaks its rules: section groups, a cookie banner that isn't one section with ConsentBanner or every hook, a cart drawer with no cart field, search suggestions with no option, or an Added notification with no title or close button. | Fix the template. |
| core_missing | The core's files can't be found. | Run npm i -D @swell/wave-theme-core, or pass --core. |
| out_dir | The build's output folder is the theme folder, or inside theme/, assets/ or the core. | Build into app/. |
| out_edited | A file in the output folder changed since the last build. | Move the change into theme/, then build. |
| out_not_build | The output folder exists and a build didn't write it. | Move or delete the folder. |

Don't name a section or block type `app_block`, or start one with `platform_`: those names are reserved for Wave's own sections.

### Warnings

A warning doesn't stop the build, but fix it before you list the theme.

| Rule | Warned when | Fix |
| --- | --- | --- |
| brand_mention | A section or block mentions wave or tide in its code or text. | Remove those names from code and shopper copy. Art such as a wave shape is fine. |
| no_settings | The theme has no theme/config/settings.json, so it uses Wave's default colors, fonts and spacing. | Add theme/config/settings.json with your theme's design. |
| store_text_label | A new Store text area in language.json has no $label, so merchants see its id on the Store text page. | Add a $label to the area. |
| platform_ui | A section's styles name a class of what Wave draws that Platform UI doesn't list, so a Wave release may change or remove it. | Restyle only through the names in platform-ui.json. |

To change how a core section looks or behaves, build a section with its own name from ui-kit pieces. Themes never override core code.

## Rules every theme follows

These apply to themes you publish and themes you build for clients. `swell theme check` refuses some of them, and Theme Store review checks the rest.

| Rule | What it means |
| --- | --- |
| Swell data drives the theme | Every page type works. Products, categories, menus, the store's name and logo, content pages and reviews come from Swell, never from the theme. When data is missing, the theme shows nothing, never made-up content such as a Best seller badge or a review count. |
| Header and Footer groups | Every template shows the shared Header and Footer groups, never its own copy. A template can hide a group on its page. |
| Store text | Fixed shopper words, such as cart, checkout and account labels and errors, are Store text, read by key. A theme adds its own keys and never redefines a core key. Section settings hold only visual and functional options and text for that section on that page. |
| Fast pages | Shopper pages load in under 0.5 seconds, and a theme must not be the reason a page misses it. Images use ui-kit's Image, which sizes them for the screen. |
| Everything visible | No scroll-driven reveals that start a section hidden. Content shows without scrolling, timers or motion. |
| Payment icons | Payment methods show as brand logos through ui-kit's PaymentIcons, never as words. The footer keeps a setting to show or hide them. |
| Accounts and cart | Shoppers can sign in, create an account, reset their password, use their account pages and use the cart. Use ui-kit's AuthForms, AccountBody and cart components, or forms that post the same fields to the same routes. Theme Store review runs the password reset on the demo store. |
| Phones first | Layouts work on phones. Filter panels stay folded, so filters never push products down. |
| Features live in apps | Functionality beyond display, such as bookings, clubs or wholesale access, belongs in an app, not in theme code. |
| Neutral names | Section and block types are named by what they do. No custom_ prefix, and no Swell product names in types, file names or shopper copy. |
| Free and paid themes | A free theme fits any kind of store: its theme.listing.industries is empty, and it has no sections built for one category. Sections built for a category, such as a size guide or a wine pairing, belong to paid themes. Either way, the theme is substantially your own sections, blocks or layouts. |

## SEO

Wave writes every page's `<title>`, meta description, canonical link, Open Graph and Twitter tags, robots meta and JSON-LD, for every theme. A theme adds none of them: section, block and layout code can't render `meta`, `link` or `script` elements, or a `title` outside an `svg`.

- `<title>`: the merchant's SEO title, else the page's title and the store's name (`Page · Store`). The home page's is the store's name.
- Meta description: the merchant's SEO description, else an excerpt of the record's own text, else, on the home page and content pages, the first section's paragraph, else, on the home page, the storefront's description, else the page's first heading or title with the store's name. Wave cuts the ones it makes to 155 characters.
- JSON-LD: `Organization` and `WebSite` with a `SearchAction` on the home page, `Product` with its `Offer` on product pages, `BreadcrumbList` on category, content page and blog post pages, and `BlogPosting` on blog posts.
- `noindex` on search, cart, account and sign-in pages.

The theme controls the rest:

- One `h1` per page, the hero's or the page's title, then headings in order.
- Real `alt` text on images. Use `""` only for decoration.
- Link and button words that say where they go, such as "Read our story". Never "Read more" or "Click here" alone: Lighthouse flags them, and the editor's SEO review lists them to the merchant.
- A real subheading on the home page's hero. Without the merchant's SEO description, the home page's description is the first paragraph of at least four words in its first section with text.
- A template's `page` object can carry `seo_title` (at most 200 characters) and `seo_description` (at most 400). They are the merchant's, set in the editor, so leave them out of a theme's templates.

## Required apps

Features beyond display, such as quotes, bookings or registries, come from apps. Sections read an app's data with `app_data` fields and post forms to it with ui-kit's `AppAction`; see [Storefront extensions](https://developers.swell.is/storefronts/storefront-extensions).

Name the apps the theme requires in `theme.apps` in the theme app's `swell.json`:

```json
{
  "theme": {
    "storefront": { "app": "wave" },
    "apps": [
      { "id": "gift_registry", "required": true, "min_version": "1.0.0", "why": "Lets customers create and share gift registries" }
    ]
  }
}
```

- `id`: the app's `id` from its `swell.json`, one of your own apps or a published app.
- `required`: optional boolean. Defaults to `false`.
- `min_version`: optional, an `x.y.z` version. A store needs at least this version to install the theme or update to this theme version.
- `why`: optional, 1 to 200 characters, shown to merchants next to the app.
- At most 10 apps, each named once, with no other keys.

Push the app before the theme: a theme that names an app Swell can't find is refused. A store can't install the theme, or use it on a storefront, until its required apps are installed. The theme's install dialog installs them in the same step, buying a paid app under its own price, and an app can't be uninstalled while a storefront's theme requires it. Wave never installs apps: its theme picker shows **Needs <app>** and opens the dashboard's install dialog.

The theme must still render when an app is missing, for example when it's disabled. A section whose app is missing gets `status: missing_app` and renders its own empty state, with no broken layout and no form that can't be sent. In the editor it shows **Needs the <app> app** with **Install**.

→ See [Required apps](https://developers.swell.is/storefronts/required-apps) for installs, enforcement, versions, pricing and review.

## Building for a client

A client theme is a private theme app in the client's own store. Nobody else sees it, and it isn't reviewed.

- Log in to the client's store with `swell login` and choose that store.
- Build and preview as in Build a theme, on a storefront in the client's store or in your development store.
- Push from `app/` with `swell app push`. The first push creates a storefront for the theme in the client's store.
- The client, or you, publishes from the Wave editor. After that, the client can edit content and settings in the editor. Keep your own changes in code and push them. The editor and your pushes both write to the storefront's draft, and the last one saved wins.

A theme built on a paid theme can be published only in a store that has bought that theme, so the client buys it first. A client theme can go in the Theme Store later: make it generic, remove the client's brand and content, and publish it as in [Publishing themes](https://developers.swell.is/storefronts/selling-themes).

## Using AI

A theme repo works with any AI coding tool:

- `AGENTS.md`, which most coding agents read, is in the package at `node_modules/@swell/wave-theme-core/AGENTS.md`. Point your tool at it, or copy it to the repo root. It holds the repo layout, the authoring rules and every rule `swell theme check` refuses, with its fix.
- The ui-kit types tell the tool which components and props exist.
- `swell theme check` names the file, the rule and the fix for each problem, so the tool can correct its own work. `--json` gives the same problems as data.

**Example prompt**

```txt
Read AGENTS.md. Add a lookbook section with a full-bleed image, a caption and three product cards
the merchant picks, with settings for the image position and the card count. Run swell theme check
and fix anything it reports.
```

Wave's own agent, in the editor, is for trying a look or layout on a development store. It changes one storefront's files and doesn't produce reusable sections, so write the finished theme in code.

## Versions and updates

A theme's `version` in `swell.json` is a semver. The build writes it to `theme/config/version.json`, so each storefront's files record the version they came from. Create a version with `swell app version` and release it as for any app; see the [Swell CLI](https://developers.swell.is/apps/cli) reference and [App Store submission](https://developers.swell.is/apps/app-store-submission).

When a newer published version exists, merchants on the theme see **Theme update available** in the Wave editor. The review shows the version's release notes, what the update brings, the merchant's edits it keeps, and each conflict, where the merchant chooses **Keep mine** or **Use the theme's**. Apply writes the result to the storefront's draft after saving a version, and nothing goes live until the merchant publishes. Only published versions are offered, and only stores that have bought a paid theme can apply its updates. In the Swell dashboard, a Wave storefront's theme update opens the Wave editor.

- Files the storefront didn't change take the new version, and the merchant's changes are kept.
- Templates and groups merge section by section and prop by prop, Store text key by key, and code files as a whole.
- Only files the merchant changed can conflict.
- A file the new version removes is removed from storefronts that didn't change it.
- `settings.json` is never updated.

Templates on merchants' storefronts hold your section types, block types and field ids. Never rename them: retire a field or a type with `retired: true` instead, give a new scalar field a default with `fill: true`, and add Store text keys rather than changing what an existing key means. Write release notes in plain words with each version.

## Publishing a Wave theme

[Publishing themes](https://developers.swell.is/storefronts/selling-themes) covers the Theme Store for every theme. For a Wave theme:

- It must pass `swell theme check`. Release it from `app/`.
- It can build on `@swell/wave-theme-core` and ui-kit, which every Wave theme uses, as well as Swell's free themes. The similarity check leaves files from `@swell/wave-theme-core` out of the comparison too. `swell theme check` doesn't run the similarity check.
- `theme.listing.demo_url` names Wave's demo frame, `https://<store>--<storefront>--preview.swell.store/__demo`. The Theme Store adds `/__demo` to a bare host. The demo frame shows the store under a bar with the theme's name, a desktop and phone switch, **Try theme** and a link back to the Theme Store, with checkout turned off. **Try theme** (**Try theme free** for a paid theme) installs the theme as a new storefront, after signing the merchant up if they have no store, and a paid theme installs on trial. It shows once the theme is published. The demo frame opens only for a storefront in your own store: one of your development stores, or the store that owns the theme app.
- The full description says how merchants change the look in Wave's Theme tab and edit pages with the agent.
- Review checks the rules in Rules every theme follows above. Merchants get published versions as theme updates in the Wave editor and choose when to apply them to their draft.
- On trial, merchants can also change section groups and Store text. Wave's AI can't redesign the storefront or change the theme's code, and a trial draft is served only on the preview host, with signed share links.
