> For the complete documentation index, see [llms.txt](https://docs.liquidcommerce.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcommerce.cloud/elements-v2/theming.md). Agents can also search and read this documentation through its [MCP server](https://docs.liquidcommerce.cloud/~gitbook/mcp).

# Theming

Match Elements to your brand: colors, fonts, corner radius, and per-component layout — all set through a single `customTheme` config object. This page is the full reference; see [Advanced → Theming](https://docs.liquidcommerce.cloud/elements-v2/advanced.md#theming) for the short version and [Quick Start Guide → Custom theme config](https://docs.liquidcommerce.cloud/elements-v2/quick-start-guide.md#custom-theme-config) for how to deliver `customTheme` via a CDN script tag.

## How theming works

* Every partner has a default theme configured server-side (via the LiquidCommerce dashboard/builder tool). The SDK fetches it during `Elements()` initialization.
* Passing `customTheme` in your `Elements()` config deep-merges your overrides on top of that server default. You only need to set the keys you want to change — everything else falls back to the server value.
* `customTheme` is read **once, at init time**. The client object returned by `Elements()` has no runtime "update theme" method — to change the theme, reinitialize with a new `customTheme` (typically on a fresh page load).
* The merge is schema- and type-validated, not a blind object spread:
  * A key that doesn't exist on the target schema is dropped, with a console warning.
  * A value whose type doesn't match the target's type (e.g. a string where a boolean is expected) is dropped, with a console warning.
  * Arrays are replaced wholesale.
* `global.layout.showPoweredBy` can never be overridden by `customTheme` — its server value is restored immediately after the merge, since "Powered by LiquidCommerce" visibility is a paid-feature gate, not a style choice. `poweredByMode` (`light`/`dark`) is host-configurable.
* Rendered components live inside a Shadow DOM (closed in production), so component styles are fully isolated from your page's own CSS — you theme through `customTheme`, not by targeting the SDK's internal styles or CSS from your host page.

`customTheme` (`IClientCustomThemeConfig`) has one optional key per config domain — `global`, `product`, `address`, `cart`, `checkout` — each a deep-partial of that domain's full config shape:

```ts
customTheme?: {
  global?: { theme?: {...}; layout?: {...} };
  product?: { theme?: {...}; layout?: {...} };
  address?: { theme?: {...} };
  cart?: { theme?: {...}; layout?: {...} };
  checkout?: { theme?: {...}; layout?: {...} };
}
```

## Global theme

### Colors

All values are CSS color strings.

| Key                     | Description                                        |
| ----------------------- | -------------------------------------------------- |
| `primaryColor`          | Primary brand/accent color used throughout the UI. |
| `accentColor`           | Secondary accent color.                            |
| `defaultTextColor`      | Default body text color.                           |
| `selectedTextColor`     | Text color for selected states.                    |
| `linkTextColor`         | Link text color.                                   |
| `errorColor`            | Error/validation state color.                      |
| `warningColor`          | Warning state color.                               |
| `successColor`          | Success state color.                               |
| `drawerBackgroundColor` | Background color of the cart/checkout drawer.      |

```js
const client = await Elements('YOUR_API_KEY', {
  env: 'production',
  customTheme: {
    global: {
      theme: {
        primaryColor: '#007bff',
        accentColor: '#28a745',
        defaultTextColor: '#333333',
        selectedTextColor: '#007bff',
        linkTextColor: '#0056b3',
        errorColor: '#dc3545',
        warningColor: '#ffc107',
        successColor: '#28a745',
        drawerBackgroundColor: '#ffffff'
      }
    }
  }
});
```

### Fonts

`headingFont` and `paragraphFont` each take `{ name, weights }`:

```js
customTheme: {
  global: {
    theme: {
      headingFont: { name: 'Poppins', weights: [400, 600, 700] },
      paragraphFont: { name: 'Inter', weights: [400, 500] }
    }
  }
}
```

> **Google Fonts only.** `name` must be a valid Google Font name. `Poppins` (weights 400/500/600/700) is always loaded alongside whatever you configure, so it's available as a fallback regardless of your settings. Font loading requires network access to `fonts.googleapis.com` and `fonts.gstatic.com` — allow these hosts if your environment enforces a CSP or routes traffic through a proxy.

### Corner radius

`buttonCornerRadius` and `cardCornerRadius` take CSS length strings (e.g. `'8px'`):

```js
customTheme: {
  global: {
    theme: {
      buttonCornerRadius: '8px',
      cardCornerRadius: '12px'
    }
  }
}
```

## Global layout

| Key                         | Type                     | Notes                                                                                                 |
| --------------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------- |
| `enablePersonalization`     | `boolean`                | Turns engraving/personalization UI on across product, cart, and checkout.                             |
| `personalizationText`       | `string`                 | Label shown wherever personalization is offered (e.g. "Add Engraving").                               |
| `personalizationCardStyle`  | `'outlined' \| 'filled'` | Visual style of the personalization card.                                                             |
| `allowPromoCodes`           | `boolean`                | Shows/hides the promo code entry in cart and checkout.                                                |
| `inputFieldStyle`           | `'outlined' \| 'filled'` | Style applied to text inputs across address, cart, and checkout.                                      |
| `enableOrderedProductSizes` | `boolean`                | Sorts size selectors (product and product list) to match `orderedProductSizes`.                       |
| `orderedProductSizes`       | `string[]`               | Explicit size order used when `enableOrderedProductSizes` is `true`, e.g. `['750ml', '1L', '1.75L']`. |
| `showPoweredBy`             | `boolean`                | **Server-locked.** Cannot be set via `customTheme` — see [How theming works](#how-theming-works).     |
| `poweredByMode`             | `'light' \| 'dark'`      | Style of the "Powered by" badge, when shown.                                                          |

```js
customTheme: {
  global: {
    layout: {
      enablePersonalization: true,
      personalizationText: 'Add Engraving',
      personalizationCardStyle: 'outlined',
      allowPromoCodes: true,
      inputFieldStyle: 'outlined',
      enableOrderedProductSizes: true,
      orderedProductSizes: ['750ml', '1L', '1.75L'],
      poweredByMode: 'light'
    }
  }
}
```

## Per-component theme & layout

Each component domain accepts its own `theme` (colors) and, where applicable, `layout` (behavior/copy) block.

### Product

```js
customTheme: {
  product: {
    theme: {
      backgroundColor: '#ffffff'
    },
    layout: {
      showImages: true,
      showOnlyMainImage: false,
      showTitle: true,
      showDescription: true,
      descriptionPosition: 'below',        // 'above' | 'below'
      showQuantityCounter: true,
      showOffHours: true,
      quantityCounterStyle: 'outlined',    // 'outlined' | 'ghost'
      fulfillmentDisplay: 'carousel',      // 'carousel' | 'popup'
      enableShippingFulfillment: true,
      enableOnDemandFulfillment: true,
      primaryFulfillmentMethod: 'shipping',  // 'shipping' | 'onDemand'
      addToCartButtonText: 'Add to Cart',
      addToCartButtonShowTotalPrice: true,
      buyNowButtonText: 'Buy Now',
      preSaleButtonText: 'Pre-order',
      prioritizeEngraving: false,
      noAvailabilityText: 'Not available in your area'
    }
  }
}
```

See [Product](https://docs.liquidcommerce.cloud/elements-v2/product.md) for what each layout option affects on screen.

### Cart

```js
customTheme: {
  cart: {
    theme: {
      backgroundColor: '#ffffff'
    },
    layout: {
      showQuantityCounter: true,
      quantityCounterStyle: 'outlined',    // 'outlined' | 'ghost'
      drawerHeaderText: 'Your Shopping Cart',
      goToCheckoutButtonText: 'Proceed to Checkout'
    }
  }
}
```

See [Cart](https://docs.liquidcommerce.cloud/elements-v2/cart.md) for cart behavior.

### Checkout

```js
customTheme: {
  checkout: {
    theme: {
      backgroundColor: '#ffffff'
    },
    layout: {
      emailOptIn: {
        show: true,
        checked: false,
        text: 'Subscribe to our newsletter for updates and offers.'
      },
      smsOptIn: {
        show: true,
        checked: false,
        text: 'Receive SMS updates about your order and exclusive deals.'
      },
      allowGiftCards: true,
      legalMessage: {
        show: true,
        text: 'By placing your order, you agree to our Terms of Service and Privacy Policy.'
      },
      continueShoppingUrl: 'https://yoursite.com/shop',
      exitUrl: 'https://yoursite.com',
      thankYouButtonText: 'Continue Shopping',
      drawerHeaderText: 'Checkout',
      placeOrderButtonText: 'Place Order',
      checkoutCompleted: {
        customLogo: 'https://yoursite.com/logo.png',
        customText: 'Thank you for your purchase! Your order has been received.'
      }
    }
  }
}
```

> `emailOptIn.text`, `smsOptIn.text`, and `legalMessage.text` are rendered as raw HTML, not escaped text — useful for inline links (e.g. to your terms page), but don't pass unsanitized user input into these fields.

See [Checkout](https://docs.liquidcommerce.cloud/elements-v2/checkout.md) for the full checkout flow.

### Address

```js
customTheme: {
  address: {
    theme: {
      backgroundColor: '#ffffff'
    }
  }
}
```

The address component only exposes `theme.backgroundColor` — there's no `layout` block for it. See [Address](https://docs.liquidcommerce.cloud/elements-v2/address.md).

## Complete example

```js
const client = await Elements('YOUR_API_KEY', {
  env: 'production',
  customTheme: {
    global: {
      theme: {
        primaryColor: '#007bff',
        accentColor: '#28a745',
        buttonCornerRadius: '8px',
        cardCornerRadius: '12px',
        headingFont: { name: 'Poppins', weights: [400, 600, 700] },
        paragraphFont: { name: 'Inter', weights: [400, 500] }
      },
      layout: {
        allowPromoCodes: true,
        inputFieldStyle: 'outlined'
      }
    },
    product: {
      layout: {
        addToCartButtonText: 'Add to Bag',
        fulfillmentDisplay: 'popup'
      }
    },
    cart: {
      layout: {
        goToCheckoutButtonText: 'Checkout Now'
      }
    }
  }
});
```

## Delivering `customTheme` via the CDN

If you're using the auto-init script tag instead of the programmatic client, pass the same `customTheme` object as JSON in a `data-liquid-commerce-elements-custom-theme` script tag — see [Quick Start Guide → Custom theme config](https://docs.liquidcommerce.cloud/elements-v2/quick-start-guide.md#custom-theme-config) for the exact markup.
