Skip to main content

Introduction

You can customise the appearance of the web components to match your branding in two ways:
  1. Dashboard settings — Use the Customisation page in Settings > Web Components to set colours, card styles, border radius, and more — no code required.
  2. CSS overrides — For more control, add custom CSS to your website using CSS variables and CSS parts (described below).
Most stores only need the dashboard settings. CSS overrides are optional and recommended only if you need fine-grained control that goes beyond what the dashboard offers. If you do use CSS, ask your web developer for help.
We use TailwindCSS to style the web components, which are isolated from your global CSS so that they do not affect the rest of your website. There are two ways to customise the styling:
  1. CSS Variables - For simple changes like colors, border radius, and font size. Override a few variables and all components update automatically. This is the quickest way to match your brand colors.
  2. CSS Parts - For more in-depth control over individual elements within components. Use the ::part() selector to target specific buttons, icons, text, and other elements with full CSS flexibility.
Most sites only need CSS variables. Use parts when you need fine-grained control over specific elements.

CSS Variables

You can override the default colors, border radius, and font size used by all web components by setting CSS custom properties (variables) on your page. These variables are defined on the :host selector and can be overridden globally.

Example

:root {
    --marzipan-color-primary: #8b5cf6;
    --marzipan-color-primary-hover: #a78bfa;
    --marzipan-radius: 0.5rem;
}

Color Variables - Primary

VariableDefaultDescription
--marzipan-color-primary#3b82f6Primary brand color
--marzipan-color-primary-hover#60a5faPrimary color on hover state

Color Variables - Secondary

VariableDefaultDescription
--marzipan-color-secondary#e5e7ebSecondary background color
--marzipan-color-secondary-hover#d1d5dbSecondary color on hover state

Color Variables - Button Borders

VariableDefaultDescription
--marzipan-color-button-bordertransparentBorder colour for primary buttons
--marzipan-color-button-border-hovertransparentBorder colour for primary buttons on hover
--marzipan-color-secondary-bordertransparentBorder colour for secondary buttons
--marzipan-color-secondary-border-hovertransparentBorder colour for secondary buttons on hover

Color Variables - Text

VariableDefaultDescription
--marzipan-color-text#111827Primary text color
--marzipan-color-text-muted#6b7280Muted/secondary text color
--marzipan-color-text-inverse#ffffffInverse text color for dark backgrounds

Color Variables - Backgrounds

VariableDefaultDescription
--marzipan-color-bg#ffffffPrimary background color
--marzipan-color-bg-muted#f9fafbMuted background color
--marzipan-color-bg-overlayrgba(107, 114, 128, 0.4)Overlay background with transparency

Color Variables - Borders

VariableDefaultDescription
--marzipan-color-border#d1d5dbStandard border color
--marzipan-color-border-muted#e5e7ebMuted border color

Color Variables - Status

VariableDefaultDescription
--marzipan-color-error#ef4444Error state color
--marzipan-color-error-bg#fef2f2Error background color
--marzipan-color-success#22c55eSuccess state color
--marzipan-color-success-bg#f0fdf4Success background color
--marzipan-color-warning#f59e0bWarning state color
--marzipan-color-warning-bg#fffbebWarning background color

Color Variables - Badges

VariableDefaultDescription
--marzipan-color-badge-bg#ffedd5Badge background color
--marzipan-color-badge-text#9a3412Badge text color

Color Variables - Inputs

VariableDefaultDescription
--marzipan-color-input-bg#ffffffInput field background color
--marzipan-color-input-disabled-bg#f9fafbDisabled input background color

Border Radius Variables

VariableDefaultDescription
--marzipan-radius0.375remStandard border radius
--marzipan-radius-lg0.5remLarger border radius

Font Size Variable

VariableDefaultDescription
--marzipan-font-size16pxBase font size for components

CSS Parts

We use the part attribute to style individual elements within the web components. The format is always web-component::part(element-name).

Examples

This CSS would target the button within the add to cart component, using Tailwind classes that exist with your own CSS styles.
marzipan-addtocart::part(--add-to-cart-button) {
    @apply text-white py-3 px-4 uppercase no-underline text-sm hover:bg-zinc-900;
}
And this CSS would target the cart icon of the cart icon component using traditional CSS.
marzipan-carticon::part(cart-icon) {
    color: #bebebe;
}
Because of how the web components are structured and how part works, we may use the same name for the same part in different components. For example, the --marzipan-spinner part is used in multiple components. However you must target each part separately:
marzipan-cart::part(--marzipan-spinner), marzipan-checkout::part(--marzipan-spinner) {
    color: #399383
}

Available parts

Available parts are listed under each component’s Styling section.