Skip to main content

Theme CSS variables reference

Theme CSS variables are a set of standard style variables that themes provide to app blocks. They all start with --spz-theme-. When your block references them in its styles, its buttons, prices, fonts, corner radii, and other visuals follow the store's current theme and the merchant's settings. Without these variables, block styles have to be hard-coded, so when the merchant changes the theme's colors or button radius, your block doesn't follow; with them, the same block styles work on every supported theme. There are 163 variables.

Theme CSS variables only provide individual style values. They don't provide structural information such as layout, position, or visibility, and they don't provide a JavaScript interface. To read product data or listen for buyer actions, use ThemeApi. Pages that the theme doesn't render, such as the checkout page or custom landing pages, don't have these variables.

Quick start​

Reference variables with var() in your block's CSS. The first argument is the variable name, and the second is the fallback value, the value your block hard-coded before it used the variables.

css
.my-app-block .cta {
background: var(--spz-theme-button-bg-color, #1d1f23);
color: var(--spz-theme-button-text-color, #ffffff);
border-radius: var(--spz-theme-button-radius, 4px);
}
.my-app-block .price {
color: var(--spz-theme-pdp-price-color, #1c1f23);
font-size: var(--spz-theme-pdp-price-font-size, 24px);
}
Always provide a fallback value

In these cases the page has no matching variable: the store's theme isn't supported, the page isn't rendered by the theme, or the theme doesn't provide that variable. The browser then uses the second argument, and your block looks the way it did before. Without a second argument, the declaration is dropped entirely.

On stores that use a supported theme, the page <head> automatically includes a <style id="spz-theme-vars"> block. Your block doesn't need to load any script or stylesheet; reference the variables directly in its CSS. When the merchant changes the theme settings, the variable values change with them.

To check whether a store outputs the variables, search for spz-theme-vars in the Elements panel of your browser's developer tools; if you find the <style> block, the variables are in place. You can also run the following in the Console; a non-empty value means the variables are available:

javascript
getComputedStyle(document.body).getPropertyValue('--spz-theme-button-bg-color')

Color variables take their values from the theme's color scheme and can be empty when read on the html element, so read them on body or on your block's own element.

Theme support​

For themes not listed below, the page has none of these variables and your block uses its fallback values.

ThemeMinimum versionVariables providedNotes
Reformiav26.54.44162 / 163Color variables follow the color scheme of each section
Novav26.19.0159 / 163A few variables have different values inside the cart drawer
Faridav26.13.0159 / 163A few variables have different values inside the cart drawer
Herov26.13.0156 / 163
Geekv26.18.0162 / 163A few variables have different values inside the cart drawer
Evav26.12.27159 / 163

Variables a theme doesn't provide are marked in the "Not provided by" column of the variable list. On those themes, your block uses the fallback values.

Reformia outputs CSS variables starting from v26.54.44, later than the v26.54.17 that ThemeApi requires. If your block uses both, v26.54.44 is the minimum.

Choose and reference variables​

Naming​

Each variable name has four parts: prefix, scenario, element, and property.

text
--spz-theme- pdp- atc-button- radius
prefix scenario element property
Scenario partScenarioCoversVariables
(none)GlobalShared across pages: page width and margins, grid spacing, text colors, button shape and colors, inputs, overlay shadow, and the corner radius of toasts, progress bars, and pills30
pdp-Product pageProduct title, prices, discount badge, variant buttons, quantity selector, add-to-cart and buy-now buttons, stock notice65
plp-Collection pageCollection title and product cards (product name, price, compare-at price, badges, swatches, image, container)28
cart-CartDrawer container, cart title, line items, subtotal area, checkout button36
atc-modal-Added-to-cart modalWidth, height, border, and corner radius of the modal that appears after an item is added to the cart4

atc-modal- refers to the modal that appears after a buyer adds an item to the cart, not the quick add modal.

Choosing a variable​

Each variable takes its value from one of the theme's elements, and the variable name names that element. --spz-theme-button-bg-color is the background of the theme's primary button, and --spz-theme-pdp-save-badge-radius is the corner radius of the discount badge on the product page. You can use these values on any element of your block, on any page.

When choosing a variable, ask which theme element this part of your block should look like.

  • A solid button in your block matches the theme's primary button: use --spz-theme-button-*.
  • Outline buttons and dropdowns match the secondary button: use --spz-theme-button-secondary-*.
  • A promotion label matches the discount badge: use --spz-theme-pdp-save-badge-*.

The same kind of element can have different values on different pages. For example, the main price on the product page and the line item price in the cart have different font sizes, so variables are grouped by scenario. When the page your block is on has the matching element, prefer that scenario's variables. For shared visuals such as buttons, inputs, and overlay shadows, use the global variables without a scenario part.

Syntax​

css
/* Follow directly */
background: var(--spz-theme-button-bg-color, #1d1f23);

/* Scale */
font-size: calc(var(--spz-theme-pdp-variant-title-font-size, 14px) * 0.8);

/* Clamp to a range */
border-radius: min(var(--spz-theme-button-radius, 4px), 8px);
font-size: clamp(12px, var(--spz-theme-pdp-variant-title-font-size, 14px), 18px);
  • Variables ending in -border are full border shorthand values, for example 1px solid #e5e5e5. Use them with border.
  • Variables ending in -padding are padding shorthand values with two or four values. Use them with padding; they can't go inside calc().
  • --spz-theme-overlay-shadow is a full box-shadow value.
  • A few variables use a short attribute segment: names ending in -bg are background colors, the same as -bg-color, and --spz-theme-cart-checkout-color is the text color of the checkout button.

Scope​

Most variables have a single value across the page, so your block gets the same result wherever it sits. In the three cases below, the value depends on where your block is. Place your block inside the matching container and it picks up the matching values automatically.

CaseThemesVariables affectedDescription
Color scheme sectionsReformia49 color variablesWhen your block is inside a section that uses a non-default color scheme, color variables take that section's colors
Cart drawerNova, Farida, GeekA few cart variablesWhen your block is inside the cart drawer, it gets the values inside the drawer
MobileAll themesSome font size and dimension variablesValues switch automatically below the theme's own breakpoint; you don't need media queries

If your block's container isn't inside the cart drawer but needs the drawer values, add the data-spz-theme-scope="cart-drawer" attribute to the container:

html
<div class="my-app-block" data-spz-theme-scope="cart-drawer">
<!-- Cart variables here take the drawer values -->
</div>

To use a specific color scheme on Reformia, add the theme's color scheme class to the container, for example class="color-scheme-3". Overlays attached to body get the page's default color scheme.

Rules​

Basic rules​

Don't override the standard variables

Don't assign --spz-theme-* values on html, body, or theme sections. The theme's own elements also read these variables, so overriding them changes the theme's buttons and prices and overrides the values for color scheme sections and the cart drawer.

  • Always provide a fallback: give every var() a second argument.
  • Don't output empty values: --x: ; is a valid empty value in CSS. It doesn't trigger the fallback and makes the whole declaration fail. When one of your app's own setting variables has no value, don't output that line.
  • Only reference --spz-theme-*: the theme's other CSS variables may be renamed or removed when the theme is upgraded. The --spz-theme-* names are defined by this page.
  • Match the names in the list: a misspelled variable name doesn't cause an error in the browser; it silently uses the fallback.
  • Use your own prefix for derived values: declare scaled, clamped, or semi-transparent values in your block's own container with your app's prefix, for example --plg-*. Don't declare new --spz-theme-* variables.

Combining with your app's settings​

When your app has its own settings, the order of precedence is app setting, then theme, then fallback. One nested var() expresses this:

css
.my-app-block {
/* Use the app setting if the merchant set one; otherwise follow the theme; otherwise use the fallback */
--plg-btn-bg: var(--cfg-btn-bg, var(--spz-theme-button-bg-color, #1d1f23));
}
.my-app-block .cta { background: var(--plg-btn-bg); }

Exceptions for specific themes​

The variables reflect each theme's design as it is, and a value on a particular theme may not suit how your block uses it. For example, Geek's buy-now button is an outline button with a transparent background. transparent is a valid value, so it doesn't trigger the fallback. In this case, override your app's own variable for that theme on your block's root node, and keep referencing --spz-theme-* for the exception value:

css
.my-app-block {
--plg-selected: var(--spz-theme-pdp-buy-button-bg-color, #1d1f23);
}
#geek-theme .my-app-block {
--plg-selected: var(--spz-theme-pdp-buy-button-border-color, #1d1f23);
}

Each theme has a fixed identifier on body. It doesn't change when the merchant renames or duplicates the theme.

ThemeSelector
Reformia#next-theme
Nova#nova-theme
FaridaSame as Nova; can't be told apart by identifier
Hero#hero-2024
Geek#geek-theme
Evabody.eva

Variable list​

"Source" tells you which theme element and property the variable takes its value from. An empty "Not provided by" column means all six themes provide the variable.

Global (30)​

VariableSourceNot provided byNotes
--spz-theme-page-widthPage width · Maximum width
--spz-theme-page-gutterPage side margins · Side margins
--spz-theme-grid-gap-xGrid spacing · Horizontal spacing
--spz-theme-grid-gap-yGrid spacing · Vertical spacing
--spz-theme-button-radiusButton shape · Border radius
--spz-theme-button-border-widthButton shape · Border width
--spz-theme-button-paddingButton shape · Primary button paddingNova, Farida, Hero
--spz-theme-button-secondary-paddingButton shape · Secondary button paddingNova, Farida, Hero
--spz-theme-text-colorText colors · Body text colorFollows the color scheme on Reformia
--spz-theme-heading-colorText colors · Heading colorFollows the color scheme on Reformia
--spz-theme-button-bg-colorButton colors / primary button · Primary button backgroundFollows the color scheme on Reformia
--spz-theme-button-text-colorButton colors / primary button · Primary button text colorFollows the color scheme on Reformia
--spz-theme-button-border-colorButton colors / primary button · Primary button border colorFollows the color scheme on Reformia
--spz-theme-button-secondary-bg-colorButton colors / secondary button · Secondary button backgroundFollows the color scheme on Reformia
--spz-theme-button-secondary-text-colorButton colors / secondary button · Secondary button text colorFollows the color scheme on Reformia
--spz-theme-button-secondary-border-colorButton colors / secondary button · Secondary button border colorFollows the color scheme on Reformia
--spz-theme-button-hover-bg-colorButton hover · Hover backgroundFollows the color scheme on Reformia
--spz-theme-button-hover-text-colorButton hover · Hover text colorFollows the color scheme on Reformia
--spz-theme-button-hover-border-colorButton hover · Hover border colorFollows the color scheme on Reformia
--spz-theme-button-secondary-hover-bg-colorSecondary button hover · Hover backgroundFollows the color scheme on Reformia
--spz-theme-button-secondary-hover-text-colorSecondary button hover · Hover text colorFollows the color scheme on Reformia
--spz-theme-button-secondary-hover-border-colorSecondary button hover · Hover border colorFollows the color scheme on Reformia
--spz-theme-input-bg-colorInput · BackgroundFollows the color scheme on Reformia
--spz-theme-input-text-colorInput · Text colorFollows the color scheme on Reformia
--spz-theme-input-border-colorInput · Border colorFollows the color scheme on Reformia
--spz-theme-input-radiusInput · Border radius
--spz-theme-overlay-shadowOverlay shadow · ShadowNova, Farida, EvaFollows the color scheme on Reformia
--spz-theme-toast-radiusToast / progress bar / pill radius · Toast
--spz-theme-progress-radiusToast / progress bar / pill radius · Progress bar
--spz-theme-pill-radiusToast / progress bar / pill radius · Pill label

Product page (65)​

VariableSourceNot provided byNotes
--spz-theme-pdp-title-font-familyProduct title · Font family
--spz-theme-pdp-title-font-sizeProduct title · Font size
--spz-theme-pdp-title-line-heightProduct title · Line height
--spz-theme-pdp-title-font-weightProduct title · Font weight
--spz-theme-pdp-title-colorProduct title · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-subtitle-font-sizeSubtitle / short description · Font sizeHero
--spz-theme-pdp-subtitle-line-heightSubtitle / short description · Line height
--spz-theme-pdp-subtitle-font-weightSubtitle / short description · Font weight
--spz-theme-pdp-subtitle-colorSubtitle / short description · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-price-font-familyMain price · Font family
--spz-theme-pdp-price-font-sizeMain price · Font size
--spz-theme-pdp-price-line-heightMain price · Line height
--spz-theme-pdp-price-font-weightMain price · Font weight
--spz-theme-pdp-price-colorMain price · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-compare-price-font-sizeCompare-at price · Font size
--spz-theme-pdp-compare-price-line-heightCompare-at price · Line height
--spz-theme-pdp-compare-price-font-weightCompare-at price · Font weight
--spz-theme-pdp-compare-price-colorCompare-at price · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-save-badge-font-sizeDiscount badge / savings label · Font size
--spz-theme-pdp-save-badge-line-heightDiscount badge / savings label · Line height
--spz-theme-pdp-save-badge-font-weightDiscount badge / savings label · Font weight
--spz-theme-pdp-save-badge-colorDiscount badge / savings label · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-save-badge-borderDiscount badge / savings label · Border
--spz-theme-pdp-save-badge-radiusDiscount badge / savings label · Border radiusEva
--spz-theme-pdp-save-badge-paddingDiscount badge / savings label · Padding
--spz-theme-pdp-variant-title-font-familyVariant group title · Font family
--spz-theme-pdp-variant-title-font-sizeVariant group title · Font size
--spz-theme-pdp-variant-title-font-weightVariant group title · Font weight
--spz-theme-pdp-variant-font-sizeVariant button · Font sizeHero
--spz-theme-pdp-variant-line-heightVariant button · Line height
--spz-theme-pdp-variant-font-weightVariant button · Font weight
--spz-theme-pdp-variant-colorVariant button · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-variant-borderVariant button · BorderFollows the color scheme on Reformia
--spz-theme-pdp-variant-radiusVariant button · Border radius
--spz-theme-pdp-variant-min-widthVariant button · Minimum width
--spz-theme-pdp-variant-min-heightVariant button · Minimum height
--spz-theme-pdp-variant-max-widthVariant button · Maximum width
--spz-theme-pdp-variant-paddingVariant button · Padding
--spz-theme-pdp-variant-gapVariant button · Button spacing
--spz-theme-pdp-qty-label-font-familyQuantity label · Font family
--spz-theme-pdp-qty-label-font-sizeQuantity label · Font size
--spz-theme-pdp-qty-label-line-heightQuantity label · Line height
--spz-theme-pdp-qty-label-font-weightQuantity label · Font weight
--spz-theme-pdp-qty-label-colorQuantity label · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-qty-font-sizeQuantity selector · Font sizeReformia, Hero
--spz-theme-pdp-qty-radiusQuantity selector · Border radius
--spz-theme-pdp-atc-button-font-sizeAdd-to-cart button · Font size
--spz-theme-pdp-atc-button-line-heightAdd-to-cart button · Line height
--spz-theme-pdp-atc-button-font-weightAdd-to-cart button · Font weight
--spz-theme-pdp-atc-button-heightAdd-to-cart button · Height
--spz-theme-pdp-atc-button-paddingAdd-to-cart button · Padding
--spz-theme-pdp-atc-button-radiusAdd-to-cart button · Border radius
--spz-theme-pdp-atc-button-bg-colorAdd-to-cart button · BackgroundFollows the color scheme on Reformia
--spz-theme-pdp-atc-button-text-colorAdd-to-cart button · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-atc-button-border-colorAdd-to-cart button · Border colorFollows the color scheme on Reformia
--spz-theme-pdp-buy-button-font-sizeBuy-now button · Font size
--spz-theme-pdp-buy-button-line-heightBuy-now button · Line height
--spz-theme-pdp-buy-button-font-weightBuy-now button · Font weight
--spz-theme-pdp-buy-button-bg-colorBuy-now button · BackgroundFollows the color scheme on Reformia
--spz-theme-pdp-buy-button-text-colorBuy-now button · Text colorFollows the color scheme on Reformia
--spz-theme-pdp-buy-button-border-colorBuy-now button · Border colorFollows the color scheme on Reformia
--spz-theme-pdp-stock-note-font-sizeStock notice · Font size
--spz-theme-pdp-stock-note-line-heightStock notice · Line height
--spz-theme-pdp-stock-note-font-weightStock notice · Font weight
--spz-theme-pdp-stock-note-colorStock notice · Text color

Collection page (28)​

VariableSourceNot provided byNotes
--spz-theme-plp-title-font-sizeCollection title · Font size
--spz-theme-plp-title-line-heightCollection title · Line height
--spz-theme-plp-title-font-weightCollection title · Font weight
--spz-theme-plp-title-font-familyCollection title · Font family
--spz-theme-plp-title-colorCollection title · ColorFollows the color scheme on Reformia
--spz-theme-plp-card-title-font-sizeProduct card / product name · Font size
--spz-theme-plp-card-title-line-heightProduct card / product name · Line height
--spz-theme-plp-card-title-font-weightProduct card / product name · Font weight
--spz-theme-plp-card-title-font-familyProduct card / product name · Font family
--spz-theme-plp-card-title-colorProduct card / product name · Text colorFollows the color scheme on Reformia
--spz-theme-plp-card-price-font-sizeProduct card / price · Font size
--spz-theme-plp-card-price-font-weightProduct card / price · Font weight
--spz-theme-plp-card-price-colorProduct card / price · ColorFollows the color scheme on Reformia
--spz-theme-plp-card-compare-font-sizeProduct card / compare-at price · Font size
--spz-theme-plp-card-compare-line-heightProduct card / compare-at price · Line height
--spz-theme-plp-card-compare-font-weightProduct card / compare-at price · Font weight
--spz-theme-plp-card-compare-colorProduct card / compare-at price · ColorFollows the color scheme on Reformia
--spz-theme-plp-badge-font-sizeProduct card / discount badge · Font size
--spz-theme-plp-badge-paddingProduct card / discount badge · Padding
--spz-theme-plp-badge-radiusProduct card / discount badge · Border radius
--spz-theme-plp-badge-colorProduct card / discount badge · ColorFollows the color scheme on Reformia
--spz-theme-plp-soldout-colorProduct card / sold-out label · ColorFollows the color scheme on Reformia
--spz-theme-plp-quick-add-colorProduct card / quick add · ColorFollows the color scheme on Reformia
--spz-theme-plp-swatch-gapProduct card / variant swatches / thumbnails · Spacing
--spz-theme-plp-swatch-radiusProduct card / variant swatches / thumbnails · Border radius
--spz-theme-plp-card-image-radiusProduct card / image · Border radius
--spz-theme-plp-card-image-aspect-ratioProduct card / image · Aspect ratio
--spz-theme-plp-card-radiusProduct card container · Container border radius

Cart (36)​

VariableSourceNot provided byNotes
--spz-theme-cart-drawer-widthDrawer container · Width
--spz-theme-cart-drawer-radiusDrawer container · Border radius
--spz-theme-cart-title-font-sizeCart title · Font sizeHero
--spz-theme-cart-title-line-heightCart title · Line height
--spz-theme-cart-title-font-weightCart title · Font weight
--spz-theme-cart-title-font-familyCart title · Font family
--spz-theme-cart-title-colorCart title · Text colorFollows the color scheme on Reformia
--spz-theme-cart-item-title-font-sizeLine item / product name · Font size
--spz-theme-cart-item-title-line-heightLine item / product name · Line height
--spz-theme-cart-item-title-font-weightLine item / product name · Font weight
--spz-theme-cart-item-title-font-familyLine item / product name · Font family
--spz-theme-cart-item-title-colorLine item / product name · Text colorFollows the color scheme on Reformia
--spz-theme-cart-item-variant-font-sizeLine item / variant text · Font size
--spz-theme-cart-item-variant-colorLine item / variant text · ColorFollows the color scheme on Reformia
--spz-theme-cart-item-variant-bgLine item / variant text · BackgroundNova, Farida, Hero, Geek, EvaFollows the color scheme on Reformia
--spz-theme-cart-item-price-font-sizeLine item / price · Font sizeDifferent value inside the cart drawer on Nova, Farida, Geek
--spz-theme-cart-item-price-line-heightLine item / price · Line heightDifferent value inside the cart drawer on Geek
--spz-theme-cart-item-price-font-weightLine item / price · Font weight
--spz-theme-cart-item-price-colorLine item / price · Text colorFollows the color scheme on Reformia
--spz-theme-cart-item-compare-font-familyLine item / price · Compare-at price · Font family
--spz-theme-cart-item-compare-font-sizeLine item / price · Compare-at price · Font sizeDifferent value inside the cart drawer on Nova, Farida
--spz-theme-cart-item-compare-line-heightLine item / price · Compare-at price · Line height
--spz-theme-cart-item-compare-font-weightLine item / price · Compare-at price · Font weight
--spz-theme-cart-item-compare-colorLine item / price · Compare-at price · ColorFollows the color scheme on Reformia
--spz-theme-cart-qty-heightLine item / quantity selector · Height
--spz-theme-cart-qty-widthLine item / quantity selector · Width
--spz-theme-cart-qty-radiusLine item / quantity selector · Border radiusDifferent value inside the cart drawer on Farida
--spz-theme-cart-qty-borderLine item / quantity selector · BorderFollows the color scheme on Reformia
--spz-theme-cart-item-image-radiusLine item / product image · Border radius
--spz-theme-cart-summary-card-bgSubtotal / total area · Container backgroundEvaFollows the color scheme on Reformia
--spz-theme-cart-checkout-bgCheckout button · BackgroundFollows the color scheme on Reformia
--spz-theme-cart-checkout-colorCheckout button · Text colorFollows the color scheme on Reformia
--spz-theme-cart-checkout-heightCheckout button · Height
--spz-theme-cart-checkout-font-sizeCheckout button · Font size
--spz-theme-cart-checkout-font-weightCheckout button · Font weight
--spz-theme-cart-checkout-radiusCheckout button · Border radius

Added-to-cart modal (4)​

VariableSourceNot provided byNotes
--spz-theme-atc-modal-widthModal container · Width
--spz-theme-atc-modal-max-heightModal container · Maximum height
--spz-theme-atc-modal-border-widthModal container · Border width
--spz-theme-atc-modal-radiusModal container · Border radius

FAQ​

I can't see the variables on the page

Make sure the store's theme is listed under Theme support and that the page is rendered by the theme. Select the body element in the developer tools; the Styles panel should show the --spz-theme-* variables.

My block's styles don't follow the theme

Check that the variable names match the list; a misspelled name doesn't cause an error. Then check whether the theme provides that variable.

The value is transparent or none, and the fallback isn't used

var() uses the fallback only when the variable doesn't exist. transparent, none, and auto set by the theme are valid values. If needed, handle it as described in Exceptions for specific themes.

My block in the cart drawer gets the wrong values

Make sure your block's node is inside the drawer container. If your block is attached to body, add data-spz-theme-scope="cart-drawer" to its container.