Skip to main content
The fields.json file defines global theme fields that content creators can customize through the HubSpot design manager. These fields control colors, fonts, spacing, buttons, and more across the entire theme.

File Location

theme/fields.json

Structure Overview

The file contains an array of field groups, each with multiple field definitions:
[
  {
    "label": "Global colors",
    "name": "global_colors",
    "type": "group",
    "children": [ /* color fields */ ]
  },
  {
    "label": "Global fonts",
    "name": "global_fonts",
    "type": "group",
    "children": [ /* font fields */ ]
  }
  // ... more groups
]

Field Groups

Global Colors

Defines the primary, secondary, and tertiary color palette for the theme.
{
  "label": "Primary",
  "name": "primary",
  "type": "color",
  "alternate_names": ["primary_color"],
  "visibility": {
    "hidden_subfields": {
      "opacity": true
    }
  },
  "inherited_value": {
    "property_value_paths": {
      "color": "brand_settings.primaryColor"
    }
  },
  "default": {
    "color": "#111827"
  }
}
Default: #111827 (dark gray)Inherits from: HubSpot brand settings primary colorHidden subfields: Opacity control
{
  "label": "Secondary",
  "name": "secondary",
  "type": "color",
  "alternate_names": ["secondary_color"],
  "default": {
    "color": "#F8FAFC"
  }
}
Default: #F8FAFC (light gray)Inherits from: brand_settings.colors[1]
{
  "label": "Tertiary",
  "name": "tertiary",
  "type": "color",
  "default": {
    "color": "#FFF2E5"
  }
}
Default: #FFF2E5 (cream)

Global Fonts

Defines primary (body) and secondary (heading) fonts with fallbacks.
{
  "label": "Primary",
  "name": "primary",
  "type": "font",
  "alternate_names": ["body_font"],
  "default": {
    "fallback": "sans-serif",
    "font": "Lato",
    "font_set": "GOOGLE"
  }
}
Default Font: Lato from Google FontsFallback: sans-serifUsage: Body text, paragraphs, UI elements
{
  "label": "Secondary",
  "name": "secondary",
  "type": "font",
  "alternate_names": ["heading_font"],
  "default": {
    "fallback": "sans-serif",
    "font": "Lato",
    "font_set": "GOOGLE"
  }
}
Default Font: Lato from Google FontsFallback: sans-serifUsage: Headings (h1–h6)

Spacing

Controls global spacing units used throughout the theme.
{
  "label": "Global spacing",
  "name": "global_spacing",
  "type": "group",
  "children": [
    {
      "label": "Vertical spacing",
      "name": "vertical_spacing",
      "type": "number",
      "min": 0,
      "max": 200,
      "step": 1,
      "suffix": "px",
      "default": 80
    }
  ]
}
Default: 80px Range: 0–200px Usage: Section padding, content spacing

Headings

Configures typography for each heading level (h1–h6).
{
  "label": "H1",
  "name": "h1",
  "type": "font",
  "default": {
    "size": 52,
    "size_unit": "px",
    "styles": {
      "text-decoration": "none"
    }
  }
}
Default Size: 52pxText Decoration: None

Buttons

Defines button styles including background, text, border, and corner radius.
{
  "label": "Buttons",
  "name": "buttons",
  "type": "group",
  "children": [
    {
      "label": "Background color",
      "name": "background_color",
      "type": "color",
      "default": {
        "color": "#111827"
      }
    },
    {
      "label": "Text color",
      "name": "text_color",
      "type": "color",
      "default": {
        "color": "#ffffff"
      }
    },
    {
      "label": "Border",
      "name": "border",
      "type": "border",
      "default": {
        "top": { "width": 1, "opacity": 100, "style": "solid", "color": "#111827" },
        "bottom": { "width": 1, "opacity": 100, "style": "solid", "color": "#111827" },
        "left": { "width": 1, "opacity": 100, "style": "solid", "color": "#111827" },
        "right": { "width": 1, "opacity": 100, "style": "solid", "color": "#111827" }
      }
    },
    {
      "label": "Corner radius",
      "name": "corner_radius",
      "type": "number",
      "min": 0,
      "max": 100,
      "default": 5,
      "suffix": "px"
    }
  ]
}
Defaults:
  • Background: #111827 (dark gray)
  • Text: #ffffff (white)
  • Border: 1px solid #111827
  • Corner radius: 5px

Forms

Configures form field appearance including labels, inputs, and helper text.
{
  "label": "Forms",
  "name": "forms",
  "type": "group",
  "children": [
    {
      "label": "Label text",
      "name": "label_text_color",
      "type": "color",
      "default": {
        "color": "#33475B"
      }
    },
    {
      "label": "Field background color",
      "name": "field_background_color",
      "type": "color",
      "default": {
        "color": "#ffffff"
      }
    },
    {
      "label": "Field text color",
      "name": "field_text_color",
      "type": "color",
      "default": {
        "color": "#33475B"
      }
    },
    {
      "label": "Field border color",
      "name": "field_border_color",
      "type": "color",
      "default": {
        "color": "#cbd6e2"
      }
    }
  ]
}

Field Types Reference

Available Field Types

TypeDescriptionExample Use Case
colorColor picker with hex, RGB, RGBABrand colors, backgrounds, text
fontFont family, size, weight, styleTypography settings
numberNumeric input with min/max/stepSpacing, border radius, padding
borderBorder configuration (width, style, color)Button borders, container borders
spacingMargin/padding with unitsSection spacing, content padding
choiceDropdown selectAlignment, display options
groupContainer for related fieldsOrganizing settings

Field Properties

  • label (string) — Display name in the design manager
  • name (string) — Programmatic identifier (use snake_case)
  • type (string) — Field type (see table above)
  • default (object) — Default value
  • help_text (string) — Additional guidance for editors
"visibility": {
  "hidden_subfields": {
    "opacity": true,
    "size": true
  }
}
Hide specific subfields from editors (e.g., opacity slider for colors).
"inherited_value": {
  "property_value_paths": {
    "color": "brand_settings.primaryColor"
  }
}
Pull values from HubSpot brand settings automatically.
"alternate_names": ["primary_color", "accent_color"]
Legacy field names for backward compatibility.

Accessing Theme Fields in Templates

Use the theme variable in HubL templates to access field values:
{# Access color fields #}
<div style="background-color: {{ theme.global_colors.primary.color }};">
  <p style="color: {{ theme.global_colors.secondary.color }};">
    Content
  </p>
</div>

{# Access font fields #}
<h1 style="
  font-family: {{ theme.headings.h1.font }}, {{ theme.headings.h1.fallback }};
  font-size: {{ theme.headings.h1.size }}{{ theme.headings.h1.size_unit }};
">
  Heading
</h1>

{# Access button styles #}
<button style="
  background-color: {{ theme.buttons.background_color.color }};
  color: {{ theme.buttons.text_color.color }};
  border-radius: {{ theme.buttons.corner_radius }}px;
">
  Click Me
</button>

Best Practices

Connect theme fields to HubSpot brand settings so theme colors automatically sync with the portal’s brand kit.
"inherited_value": {
  "property_value_paths": {
    "color": "brand_settings.primaryColor"
  }
}
Always include default values so pages look good even before customization.
"default": {
  "color": "#111827"
}
Simplify the editor experience by hiding advanced controls editors don’t need.
"visibility": {
  "hidden_subfields": {
    "opacity": true
  }
}

Customizing Theme Fields

To add custom theme fields:
1

Edit fields.json

Add your field definition to the appropriate group or create a new group.
{
  "label": "Custom Section",
  "name": "custom_section",
  "type": "group",
  "children": [
    {
      "label": "Accent Color",
      "name": "accent_color",
      "type": "color",
      "default": {
        "color": "#FF5733"
      }
    }
  ]
}
2

Upload to HubSpot

npm run upload:hubspot
3

Use in templates

<div style="border-left: 4px solid {{ theme.custom_section.accent_color.color }};">
  Content
</div>
Field name changes can break existing pages. If renaming a field, use alternate_names to maintain backward compatibility.

theme.json Configuration

Theme metadata and responsive breakpoints

Theme Fields Guide

Comprehensive guide to customizing theme fields

HubL Templates

Using theme fields in HubL templates

Styling Components

Applying theme styles with Tailwind CSS

Build docs developers (and LLMs) love