Skip to content

Design Editors

Design editors define the styling options merchants can adjust in the Instant Site Editor. Each editor maps to a specific design widget — color pickers, font selectors, background controls, and more.

Overview

All design editors are created using factory functions from @lightspeed/crane-api:

typescript
import { design } from '@lightspeed/crane-api';
TypeFactoryPurpose
TEXTdesign.text()Text styling (font, size, color, bold, italic, visibility)
BUTTONdesign.button()Button appearance, size, shape, color, font
IMAGEdesign.image()Image overlay (color, gradient, or none)
TOGGLEdesign.toggle()Boolean design toggle
SELECTBOXdesign.selectbox()Design dropdown selection
BACKGROUNDdesign.background()Background color or gradient
COLOR_PICKERdesign.colorPicker()Standalone color selection
LOGOdesign.logo()Logo styling (font, spacing, frame, capitalization)
DIVIDERdesign.divider()Visual separator in the editor

Color Values

Several design editors accept color values. Colors can be:

  • Hex colors: '#RGB', '#RRGGBB', or '#RRGGBBAA' format
  • Global colors: Reference the store's global color palette:
    • 'global.color.title'
    • 'global.color.body'
    • 'global.color.button'
    • 'global.color.link'
    • 'global.color.background'

Color Configuration Options

Several editors support these optional properties for controlling color selection:

PropertyTypeDescription
colorsstring[]Restricts the color picker to a specific set of colors
enableAlphaColorbooleanEnables transparency (alpha channel) in the color picker
enableAutoColorbooleanEnables the "auto" color option (uses global color)

Global Text Sizes

Text size defaults can be a specific integer (pixels) or a reference to a global text size:

  • 'global.textSize.title'
  • 'global.textSize.subtitle'
  • 'global.textSize.body'

TEXT

Text styling for headings, paragraphs, and other text content.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
colorsstring[]NoRestrict available colors
sizesinteger[]NoRestrict available font sizes (each >= 1)
enableAlphaColorbooleanNoEnable transparency in color picker
enableAutoColorbooleanNoEnable auto color option
hideVisibleTogglebooleanNoHide the visibility toggle in the editor
hideSizebooleanNoHide the size selector in the editor
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
fontstringNoFont family
sizeinteger | stringNoFont size in pixels, or a global text size reference
boldbooleanNoBold text
italicbooleanNoItalic text
colorstringNoHex color or global color reference
visiblebooleanNoWhether the element is visible

Factory

typescript
design.text({
  label: '$label.design.title_style',
  defaults: {
    font: 'global.fontFamily.heading',
    size: 'global.textSize.title',
    bold: true,
    italic: false,
    color: 'global.color.title',
    visible: true,
  },
})

BUTTON

Button styling including appearance, size, shape, color, and font.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
colorsstring[]NoRestrict available colors
enableAutoColorbooleanNoEnable auto color option
enableAlphaColorbooleanNoEnable transparency in color picker
hideVisibleTogglebooleanNoHide the visibility toggle
hideSizebooleanNoHide the size selector
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
appearancestringNo"SOLID", "OUTLINE", or "TEXT"
sizestringNo"SMALL", "MEDIUM", or "LARGE"
shapestringNo"ROUND_CORNER", "RECTANGLE", or "PILL"
fontstringNoFont family
colorstringNoHex color or global color reference
visiblebooleanNoWhether the button is visible

Factory

typescript
design.button({
  label: '$label.design.button_style',
  defaults: {
    appearance: 'SOLID',
    size: 'MEDIUM',
    shape: 'ROUND_CORNER',
    color: 'global.color.button',
    visible: true,
  },
})

IMAGE

Image design controls for overlay effects.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
staticbooleanNoMust match the content IMAGE editor's static value
colorsstring[]NoRestrict available colors (hex only)
enableAlphaColorbooleanNoEnable transparency in color picker
hideVisibleTogglebooleanNoHide the visibility toggle
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
overlaystringNo"COLOR", "GRADIENT", or "NONE"
colorstring | string[]NoOverlay color(s) — see rules below
visiblebooleanNoWhether the image is visible

Overlay Color Rules

OverlayColor Requirement
"COLOR"color is required and must be a single color value
"GRADIENT"color is required and must be an array of exactly 2 colors
"NONE" or not setcolor must not be defined

Factory

typescript
design.image({
  label: '$label.design.hero_image',
  defaults: { overlay: 'COLOR', color: '#00000066' },
})

⚠️ Validation

  • The static flag must match between content and design IMAGE editors for the same field. Mismatch produces: "Both content and design editor need to have same value for attribute static."
  • Invalid color/overlay combinations produce specific errors. For example, providing a single color when overlay is GRADIENT produces: "color must be an array when overlay is GRADIENT."

TOGGLE

Boolean design toggle for enabling or disabling design features.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
enabledbooleanNoDefault toggle state

Factory

typescript
design.toggle({
  label: '$label.design.enable_animation',
  defaults: { enabled: true },
})

SELECTBOX

Dropdown selection for design options.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
descriptionstringNoTranslation key for description text
optionsarrayNoArray of selectable options
defaultsobjectNoDefault values

Each option:

PropertyTypeRequiredDescription
valuestringNoOption value
labelstringNoTranslation key for option label

Defaults

PropertyTypeRequiredDescription
valuestringNoDefault selected value

Factory

typescript
design.selectbox({
  label: '$label.design.layout_style',
  description: '$label.design.layout_style_desc',
  options: [
    { value: 'compact', label: '$label.options.compact' },
    { value: 'spacious', label: '$label.options.spacious' },
  ],
  defaults: { value: 'compact' },
})

BACKGROUND

Background color or gradient controls.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
colorsstring[]NoRestrict available colors
enableAlphaColorbooleanNoEnable transparency in color picker
enableAutoColorbooleanNoEnable auto color option
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
stylestringNo"COLOR" or "GRADIENT"
colorstring | string[]NoBackground color(s) — see rules below

Background Color Rules

StyleColor Requirement
"COLOR"color is required and must be a single color value
"GRADIENT"color is required and must be an array of exactly 2 colors

Factory

typescript
// Solid color
design.background({
  label: '$label.design.section_background',
  defaults: { style: 'COLOR', color: '#FFFFFF' },
})

// Gradient
design.background({
  label: '$label.design.section_background',
  defaults: { style: 'GRADIENT', color: ['#FF0000', '#0000FF'] },
})

⚠️ Validation

Invalid color/style combinations produce errors:

  • "color is required when style is GRADIENT"
  • "color must be an array when style is GRADIENT"
  • "color array must have exactly 2 items when style is GRADIENT"
  • "color must be a single value when style is COLOR"

COLOR_PICKER

Standalone color picker for custom color settings that don't fit into other editor types.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
colorsstring[]NoRestrict available colors
enableAlphaColorbooleanNoEnable transparency in color picker
enableAutoColorbooleanNoEnable auto color option
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
colorstringNoHex color or global color reference

Factory

typescript
design.colorPicker({
  label: '$label.design.accent_color',
  defaults: { color: '#FF5733' },
})

Logo styling controls including text formatting, spacing, frame, and capitalization. This editor is specific to logo elements.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the editor label
colorsstring[]NoRestrict available colors
sizesinteger[]NoRestrict available font sizes (each >= 1)
defaultsobjectNoDefault values

Defaults

PropertyTypeRequiredDescription
fontstringNoFont family
sizeinteger | stringNoFont size in pixels, or a global text size reference
boldbooleanNoBold text
italicbooleanNoItalic text
colorstringNoHex color or global color reference
visiblebooleanNoWhether the logo is visible
spacingintegerNoLetter spacing (1–9)
frameobjectNoLogo frame configuration
capitalizationstringNo"none", "all", or "small"

The frame object:

PropertyTypeRequiredDescription
visiblebooleanYesWhether the frame is visible
widthintegerNoFrame width (1–49)
colorstringNoHex color or global color reference

Factory

typescript
design.logo({
  label: '$label.design.logo_style',
  defaults: {
    font: 'global.fontFamily.heading',
    size: 24,
    bold: true,
    color: 'global.color.title',
    visible: true,
    spacing: 2,
    capitalization: 'none',
    frame: { visible: false },
  },
})

ℹ️ Mandatory for Headers

The LOGO design editor is mandatory for sections with type HEADER. It must be defined with the key logo. See Sections.

DIVIDER

Visual separator in the design editor UI. Does not affect storefront rendering.

Properties

PropertyTypeRequiredDescription
labelstringYesTranslation key for the divider label
defaultsobjectNoDefault values (empty, type only)

Factory

typescript
design.divider({
  label: '$label.design.advanced_options',
})

Showcase Default Factories

When defining showcase configurations, the design.default.*() factories create standalone default values:

typescript
import { design } from '@lightspeed/crane-api';

design.default.text({ font: 'Arial', size: 18, bold: false, color: '#333333', visible: true });
design.default.button({ appearance: 'SOLID', size: 'MEDIUM', shape: 'PILL', color: '#000000', visible: true });
design.default.background({ style: 'COLOR', color: '#F5F5F5' });
design.default.image({ overlay: 'NONE' });
design.default.colorPicker({ color: '#FF0000' });
design.default.logo({ font: 'Arial', size: 20, color: '#000000', visible: true });
design.default.toggle({ enabled: true });
design.default.selectbox({ value: 'default' });

See Showcases for usage in showcase files.

Complete Example

typescript
// settings/design.ts
import { design } from '@lightspeed/crane-api';

export default {
  title_style: design.text({
    label: '$label.design.title_style',
    defaults: {
      font: 'global.fontFamily.heading',
      size: 'global.textSize.title',
      bold: true,
      italic: false,
      color: 'global.color.title',
      visible: true,
    },
  }),
  description_style: design.text({
    label: '$label.design.description_style',
    defaults: {
      font: 'global.fontFamily.body',
      size: 'global.textSize.body',
      bold: false,
      color: 'global.color.body',
      visible: true,
    },
  }),
  button_style: design.button({
    label: '$label.design.button_style',
    defaults: {
      appearance: 'SOLID',
      size: 'MEDIUM',
      shape: 'ROUND_CORNER',
      color: 'global.color.button',
      visible: true,
    },
  }),
  section_background: design.background({
    label: '$label.design.background',
    defaults: { style: 'COLOR', color: '#FFFFFF' },
  }),
  hero_image: design.image({
    label: '$label.design.hero_image',
    defaults: { overlay: 'NONE' },
  }),
};