Skip to main content

Styling

The Simple Editor uses CSS variables to customize its appearance and integrate with your product's design system. These variables allow you to override styles for layout, typography, buttons, and interactive elements.

This article describes how to customize the Simple Editor using CSS variables, including best practices and examples.

Customizing the Editor with CSS Variables​

To override the editor's default styles, add a <style> tag to your HTML or link an external stylesheet using <link>. Define your CSS variables in the :root selector.

<style>
:root {
--se-accent-color: green;
--se-text-color: #282828;
}
</style>
note

If a variable is not defined, the editor will use its default value. For best results, embed CSS variables directly in the <style> tag or ensure they are loaded before the editor initializes.

Available CSS Variables​

Core Layout​

VariableDescriptionDefault Value
--se-viewer-heightHeight of the Viewer relative to its width100%
--se-min-heightMinimum height of the editor during preload696px
--se-border-radiusBorder radius for most elements4px

Container​

VariableDescriptionDefault Value
--se-container-max-widthMaximum width of the container1280px
--se-container-padding-leftLeft padding of the container0
--se-container-padding-rightRight padding of the container0
--se-container-padding-topTop padding of the container0
--se-container-padding-bottomBottom padding of the container0

Font Size​

VariableDescriptionDefault Value
--se-title-font-sizeFont size of the product name2rem
--se-subtitle-font-sizeFont size of the product price1.5rem
--se-text-font-sizeFont size for plain text and input fields1rem
--se-option-names-font-sizeFont size for option titles in forms1rem
--se-variant-name-font-sizeFont size for design names in the Variant Design component0.875rem

Layout​

VariableDescriptionDefault Value
--se-viewer-column-sizeWidth of the Viewer columnminmax(0, 1fr)
--se-options-column-sizeWidth of the options columnminmax(0, 1fr)
--se-columns-gapGap between the Viewer and options columns40px

Padding & Margins​

VariableDescriptionDefault Value
--se-options-left-paddingLeft padding of the options list30px
--se-title-bottom-marginMargin between the product name and price8px
--se-heading-bottom-marginMargin between the heading and options section30px

Buttons​

VariableDescriptionDefault Value
--se-sm-h-button-paddingHorizontal padding for small buttons16px
--se-sm-v-button-paddingVertical padding for small buttons8px
--se-lg-h-button-paddingHorizontal padding for large buttons (e.g., Add to Cart)32px
--se-lg-v-button-paddingVertical padding for large buttons (e.g., Add to Cart)16px

Secondary button​

VariableDescriptionDefault Value
--se-secondary-button-background-colorBackground color of the secondary button#fff
--se-secondary-button-colorText color of the secondary button#282828
--se-secondary-button-border-colorBorder color of the secondary button#cccccc
--se-secondary-button-hover-colorBackground color of the secondary button on hover#f5f5f5

Symbols​

VariableDescriptionDefault Value
--se-symbol-v-input-paddingVertical padding for input fields5.5px
--se-symbol-h-input-paddingHorizontal padding for input fields16px
--se-symbols-gapGap between symbol input fields8px
--se-symbol-input-widthWidth of symbol input fields50px

Quantity Selector​

VariableDescriptionDefault Value
--se-quantity-font-sizeFont size for the quantity selector14px
--se-quantity-font-weightFont weight for the quantity selector400
--se-quantity-line-heightLine height for the quantity selector20px
--se-quantity-text-colorText color for the quantity selectorvar(--se-text-color)
--se-quantity-price-per-each-font-sizeFont size for the price per item12px
--se-quantity-price-per-each-font-weightFont weight for the price per itemvar(--se-quantity-font-weight)
--se-quantity-price-per-each-line-heightLine height for the price per item16px
--se-quantity-price-per-each-line-colorText color for the price per item#989898
--se-quantity-title-margin-bottomBottom margin for the quantity titlevar(--se-option-name-bottom-margin)
--se-quantity-title-font-weightFont weight for the quantity titlevar(--se-option-title-font-weight)
--se-quantity-title-font-sizeFont size for the quantity titlevar(--se-option-names-font-size)

Custom Text Toggle Input​

VariableDescriptionDefault Value
--se-text-toggle-font-sizeFont size for the custom text toggle input14px
--se-text-toggle-font-weightFont weight for the custom text toggle input400
--se-text-toggle-v-input-paddingVertical padding for the custom text toggle input7px
--se-text-toggle-h-input-paddingHorizontal padding for the custom text toggle input11px
--se-text-toggle-v-focus-input-paddingVertical padding for the custom text toggle input when focused6px
--se-text-toggle-h-focus-input-paddingHorizontal padding for the custom text toggle input when focused10px
--se-text-toggle-gapGap between custom text toggle inputs16px

Colors​

Text and Background​

VariableDescriptionDefault Value
--se-text-colorDefault text color#282828
--se-bg-colorBackground color for the editor#fff
--se-modal-bg-colorBackground color for modal dialogs#fff
--se-dropdown-bg-colorBackground color for dropdown listsvar(--se-bg-color)
--se-field-background-colorBackground color for input fieldstransparent

Accent Colors​

VariableDescriptionDefault Value
--se-accent-colorAccent color for interactive elements (e.g., buttons)#0090ff
--se-accent-hover-colorAccent color on hover#0072e0
--se-accent-active-colorAccent color when active#0058c2
--se-accent-contrast-colorContrast color for accent elements (e.g., text on accent background)#fff

State Colors​

VariableDescriptionDefault Value
--se-disabled-colorColor for disabled elements#a8a8a8
--se-empty-state-colorColor for empty states#cccccc
--se-blur-colorBlur color when changing PIM optionsrgba(255, 255, 255, 0.8)

Notification Colors​

VariableDescriptionDefault Value
--se-error-colorColor for error messages#db1919
--se-error-background-colorBackground color for error messages#ffebeb
--se-warning-colorColor for warning messages#bc6e00
--se-warning-background-colorBackground color for warning messages#fff9f0

Variant Design Component​

VariableDescriptionDefault Value
--se-grid-wrapper-colorBackground color for design variants#eeeeee
--se-grid-wrapper-border-colorBorder color for design variants#000000

Other Colors​

VariableDescriptionDefault Value
--se-border-colorDefault border color for elements#c4c4c4
--se-border-hover-colorBorder color on hover#8a8a8a
--se-focus-colorBorder color when an element is focused#000
--se-active-colorColor for active elements#e0e0e0
--se-wrapper-colorWrapper color for certain elements#f5f5f5
--se-modal-box-shadow-colorBox shadow color for modalsrgba(0, 0, 0, 0.25)
--se-swatch-border-colorBorder color for swatch elements#c4c4c4
--se-viewer-border-colorBorder color for the Viewervar(--se-active-color)

How to Use CSS Variables​

1. Embed in HTML​

Add CSS variables directly in a <style> tag:

<style>
:root {
--se-accent-color: #3b82f6;
--se-text-color: #1f2937;
}
</style>

2. External CSS File​

Link an external stylesheet:

<link rel="stylesheet" href="path/to/editor-theme.css">

3. Adaptive Design​

Use media queries to adjust variables for different screen sizes:

@media (max-width: 768px) {
:root {
--se-options-column-size: 320px;
}
}

4. Dynamic Updates with JavaScript​

Modify variables at runtime:

document.documentElement.style.setProperty(
'--se-accent-color',
'#10b981'
);

Best Practices​

  • Define variables before editor initialization to avoid default fallbacks.
  • Use semantic names for variables (e.g., --se-accent-color instead of --color-blue).
  • Test responsive behavior with media queries.
  • Avoid overriding internal class names unless necessary, as they may change in future updates.
  • Use slots to add custom HTML code. This allows you to customize both the appearance and the functionality of the editor.
Was this page helpful?