
In website design, CTA (Call-to-Action) buttons are critical elements that determine the success of inquiries and resource downloads. Unlike standard text-only buttons, the Button Module with Images introduced here allows you to incorporate intuitive icons or images. This approach strongly appeals to the user's visual senses and encourages higher click-through rates.


In website design, CTA (Call-to-Action) buttons are critical elements that determine the success of inquiries and resource downloads. Unlike standard text-only buttons, the Button Module with Images introduced here allows you to incorporate intuitive icons or images. This approach strongly appeals to the user's visual senses and encourages higher click-through rates.
The primary objective of this module is to enable anyone to easily build and manage high-quality, high-visibility visual buttons.
This section covers the entire process from creating a new page to applying the code and configuring the actual operational settings.
Start a new page (such as a landing page) from the HubSpot admin dashboard. Search for the module name in the left sidebar of the editor, then drag and drop it into the editing area.
To enable advanced design features, perform the following in the Design Manager:
Once the code is applied, you can design the button intuitively from the side panel of the editing screen.
Create a "New Module" in the HubSpot Design Manager and paste the following code into each respective section.
This is the field definition. It consists of a repeater field (Items) and style setting fields (Styles).
[
{
"allow_new_line": false,
"display_width": null,
"id": "f828e942-d88b-6872-99aa-7e6839a2ba4a",
"label": "section_title",
"locked": false,
"name": "section_title",
"required": false,
"type": "text"
},
{
"default": {
"color": null,
"opacity": null
},
"display_width": null,
"id": "23d16879-569c-2624-b906-6ae2371a442f",
"label": "title_color",
"locked": false,
"name": "title_color",
"required": false,
"type": "color"
},
{
"display": "text",
"display_width": null,
"id": "bf18e844-9553-d75c-fe55-7e0c1a65fe9d",
"label": "title_font_size",
"locked": false,
"name": "title_font_size",
"required": false,
"step": 1,
"type": "number"
},
{
"children": [
{
"default": {
"size_type": "auto",
"src": "",
"alt": null,
"loading": "lazy"
},
"display_width": null,
"id": "0c514272-f096-02d4-33c1-791a40fe2d9f",
"label": "Image",
"locked": false,
"name": "image",
"required": false,
"resizable": true,
"responsive": true,
"show_loading": false,
"type": "image"
},
{
"allow_new_line": false,
"display_width": null,
"id": "1f453c47-b6a2-a51a-f8d7-dc5248114ba0",
"label": "title",
"locked": false,
"name": "title",
"required": false,
"type": "text"
},
{
"display_width": null,
"id": "456812f3-1652-0fff-f563-f8787f2efbcc",
"label": "description",
"locked": false,
"name": "description",
"required": false,
"type": "richtext"
}
],
"default": [],
"display_width": null,
"expanded": false,
"group_occurrence_meta": null,
"id": "004e3419-0e40-def3-93c0-bf008f14bb26",
"label": "cards",
"locked": false,
"name": "cards",
"occurrence": {},
"required": false,
"tab": "CONTENT",
"type": "group"
},
{
"default": {
"color": null,
"opacity": null
},
"display_width": null,
"id": "f577bff8-1c57-1000-f2b9-0297e618fb2a",
"label": "card_title_color",
"locked": false,
"name": "card_title_color",
"required": false,
"type": "color"
},
{
"default": {
"color": null,
"opacity": null
},
"display_width": null,
"id": "33968af4-9a30-8270-1df2-5ff36ebcca38",
"label": "card_descriotion_color",
"locked": false,
"name": "card_descriotion_color",
"required": false,
"type": "color"
},
{
"display": "text",
"display_width": null,
"id": "9c9f49bb-5a85-c6b6-395b-c8577fffac7b",
"label": "card_description_font_size",
"locked": false,
"name": "card_description_font_size",
"required": false,
"step": 1,
"type": "number"
},
{
"default": {
"color": null,
"opacity": null
},
"display_width": null,
"id": "7152aefd-c5cc-1ad9-9025-c6f55715d19d",
"label": "border_color",
"locked": false,
"name": "border_color",
"required": false,
"type": "color"
},
{
"display": "text",
"display_width": null,
"id": "1c170b7c-6ba3-2f81-7881-884f1b780fc9",
"label": "border_width",
"locked": false,
"name": "border_width",
"required": false,
"step": 1,
"type": "number"
},
{
"default": false,
"display": "checkbox",
"display_width": null,
"id": "624857cf-7d81-5530-10aa-72b51715b231",
"label": "autoplay",
"locked": false,
"name": "autoplay",
"required": false,
"type": "boolean"
}
]{# スタイル変数の設定 #}
{% set v_padding = module.style_settings.button_v_padding|default(10) %}
{% set btn_width = module.style_settings.button_width|default(600) %}
{% set font_sub = module.style_settings.font_size_sub|default(12) %}
{% set font_main = module.style_settings.font_size_main|default(20) %}
{% set border_size = module.style_settings.border_size|default(1) %}
{# 色の設定 #}
{% if module.style_settings.bg_color.color %}
{% set bg_color = module.style_settings.bg_color.css %}
{% else %}
{% set bg_color = "#007bff" %}
{% endif %}
{% if module.style_settings.text_color.color %}
{% set text_color = module.style_settings.text_color.css %}
{% else %}
{% set text_color = "#ffffff" %}
{% endif %}
{% if module.style_settings.border_color.color %}
{% set border_color = module.style_settings.border_color.css %}
{% else %}
{% set border_color = "transparent" %}
{% endif %}
{# モジュールのラッパー #}
<div class="bakuraku-cta-wrapper">
{# リンクタグの設定 #}
{% set href = module.content_settings.link_field.url.href %}
{% if module.content_settings.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" ~ href %}
{% endif %}
<a href="{{ href }}"
class="bakuraku-cta-button"
style="
padding: {{ v_padding }}px 40px;
max-width: {{ btn_width }}px;
background-color: {{ bg_color }};
color: {{ text_color }};
border: {{ border_size }}px solid {{ border_color }};
"
{% if module.content_settings.link_field.open_in_new_tab %}target="_blank"{% endif %}
{% if module.content_settings.link_field.no_follow %}rel="nofollow"{% endif %}>
{# 左側の画像 #}
{% if module.content_settings.left_image.src %}
<div class="cta-image-area">
<img src="{{ module.content_settings.left_image.src }}"
alt="{{ module.content_settings.left_image.alt }}"
width="{{ module.content_settings.left_image.width }}"
height="{{ module.content_settings.left_image.height }}"
loading="lazy">
</div>
{% endif %}
{# テキストエリア #}
<div class="cta-content-area">
<div class="cta-sub-text" style="font-size: {{ font_sub }}px;">
{{ module.content_settings.sub_text }}
</div>
<div class="cta-main-text" style="font-size: {{ font_main }}px;">
{{ module.content_settings.main_text }}
</div>
</div>
</a>
</div>
{# レスポンシブ用のスタイル #}
<style>
@media (max-width: 480px) {
.bakuraku-cta-button {
padding: {{ v_padding }}px 20px !important;
}
.cta-sub-text {
font-size: {{ font_sub * 0.9 }}px !important;
}
.cta-main-text {
font-size: {{ font_main * 0.9 }}px !important;
}
}
</style>/* module.css - 基本スタイルのみ(動的な値はHTMLで設定) */
.bakuraku-cta-wrapper {
width: 100%;
display: flex;
justify-content: center;
padding: 10px;
}
.bakuraku-cta-button {
display: flex;
align-items: center;
justify-content: center;
text-decoration: none;
border-radius: 999px;
position: relative;
transition: opacity 0.3s ease;
line-height: 1.4;
box-sizing: border-box;
width: 100%;
}
.bakuraku-cta-button:hover {
opacity: 0.8;
}
.cta-image-area img {
display: block;
max-width: 60px;
height: auto;
margin-right: 15px;
}
.cta-content-area {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.cta-sub-text {
font-weight: bold;
margin-bottom: 4px;
}
.cta-main-text {
font-weight: bold;
}Yes. The module has appropriate size constraints built-in, so uploaded images are automatically adjusted to fit within the button.
This specific design defaults to a stylish "capsule" (pill-shaped) rounded corner style, optimized for visibility and clickability.
Yes. If you leave the sub-text field blank in the editor, the button will display as a simple version containing only the main text and the image.
We can customize this sample to match your specific business requirements.
Book Free ConsultationPut it on Trello!Need a fix for HubSpot, CMS, or GAS? Post it on Trello.
Development Requests Here