Logo
Home
Resources

Product

Custom Workflow

Resources

Blog
Youtube
Template
Home
>
Product
>
Template Top
>
detail

HubSpot CMS: Implementing the "Carousel Card Module" for Smart Content Organization

When introducing multiple services or case studies on a website, a long vertical list can often lead to user drop-off. The Carousel Card Module addresses this by displaying multiple content cards in a horizontal slider, allowing you to convey a wealth of information within a limited space without overwhelming the user.

‍

Demo Video

Over view
Code

Detail

When introducing multiple services or case studies on a website, a long vertical list can often lead to user drop-off. The Carousel Card Module addresses this by displaying multiple content cards in a horizontal slider, allowing you to convey a wealth of information within a limited space without overwhelming the user.

1. Objectives

The primary objective of this module is to balance information organization with intuitive usability.

  • Effective Use of Space: Group numerous items (such as features or case studies) into a single section using a sleek slider format.
  • Consistent Design Management: Manage global styles (border thickness, colors, font sizes) collectively while customizing the content of each card individually.
  • Automatic Mobile Optimization: Automatically adjusts the number of visible cards based on screen width—typically showing multiple cards on desktop and a single card on smartphones—to ensure an optimal layout on any device.

2. Use Cases

  • Service & Feature Introductions: Arrange key features in a card format, allowing users to browse through items of interest via horizontal swipes.
  • Customer Testimonials & Case Studies: Feature multiple success stories to build credibility, using the slider's motion to increase the content's read-through rate.
  • Latest News & Blogs: Display article thumbnails side-by-side to serve as an engaging navigation element that encourages site exploration.

3. Implementation Steps

This section covers everything from the setup in the Design Manager to the final configuration in the page editor.

Step 1: Applying the Code

Create a new module in the Design Manager and copy and paste the provided source code into the respective HTML/HubL, CSS, and JS sections, then publish the module.

Step 2: Basic Information and Style Setup

Place the module on your page and specify global settings such as the section heading, text colors, and font sizes to align with your brand identity.

Step 3: Adding Card Content

Under the "cards" group, add the desired number of items. For each card, input the "Image," "Title," and "Description" (using the rich text editor).

Step 4: Behavior Customization

Finalize the setup by toggling "Autoplay" on or off, and adjusting settings such as the sliding speed and border styles using simple switches or numeric inputs.

Module Source Code

Create a "New Module" in the HubSpot Design Manager and paste the following code into each respective section.

1. fields.json

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"
 }
]

Source Code

HTML
{% if module.section_title %}
<div class="hs-carousel-section">
  <h2 class="hs-carousel-title" style="color: {{ module.title_color.color }}; font-size: {{ module.title_font_size }}px;">
    {{ module.section_title }}
  </h2>
  
  <div class="hs-carousel-container">
    <button class="hs-carousel-nav hs-carousel-nav-prev" aria-label="前へ">
      <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
        <path d="M15 18L9 12L15 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
      </svg>
    </button>
    
    <div class="hs-carousel-wrapper">
      <div class="hs-carousel-track">
        {% for card in module.cards %}
        <div class="hs-carousel-card" style="border-color: {{ module.border_color.color }}; border-width: {{ module.border_width }}px;">
          {% if card.image.src %}
          <div class="hs-card-image-wrapper">
            <img src="{{ card.image.src }}" alt="{{ card.image.alt }}" class="hs-card-image">
          </div>
          {% endif %}
          
          <div class="hs-card-content">
            {% if card.title %}
            <h3 class="hs-card-title" style="color: {{ module.card_title_color.color }}; font-size: {{ module.card_title_font_size }}px;">
              {{ card.title }}
            </h3>
            {% endif %}
            
            {% if card.description %}
            <p class="hs-card-description" style="color: {{ module.card_description_color.color }}; font-size: {{ module.card_description_font_size }}px;">
              {{ card.description }}
            </p>
            {% endif %}
          </div>
        </div>
        {% endfor %}
      </div>
    </div>
    
    <button class="hs-carousel-nav hs-carousel-nav-next" aria-label="次へ">
      <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
        <path d="M9 18L15 12L9 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
      </svg>
    </button>
  </div>
  
  <div class="hs-carousel-dots"></div>
</div>
{% endif %}
CSS
.hs-carousel-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
}
.hs-carousel-title {
  text-align: center;
  margin: 0 0 40px 0;
  font-weight: bold;
  line-height: 1.2;
}
.hs-carousel-container {
  position: relative;
  padding: 0 60px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}
.hs-carousel-wrapper {
  overflow: hidden;
  margin-bottom: 30px;
  width: 100%;
  position: relative;
}
.hs-carousel-track {
  display: flex;
  transition: transform 0.5s ease;
  will-change: transform;
}
.hs-carousel-card {
  flex: 0 0 calc(33.333% - 16px);
  background: #fff;
  border-radius: 12px;
  border-style: solid;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-right: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.hs-carousel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.hs-card-image-wrapper {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hs-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
  display: block;
}
.hs-card-content {
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.hs-card-title {
  margin: 0 0 12px 0;
  font-weight: 600;
  line-height: 1.4;
}
.hs-card-description {
  margin: 0;
  line-height: 1.6;
}
.hs-carousel-nav {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: #fff !important;
  border: 2px solid #ddd !important;
  border-radius: 50% !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  z-index: 100 !important;
  color: #333 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  text-decoration: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}
.hs-carousel-nav:hover {
  background: #f5f5f5 !important;
  border-color: #999 !important;
}
.hs-carousel-nav-prev {
  left: 0 !important;
}
.hs-carousel-nav-next {
  right: 0 !important;
}
.hs-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}
.hs-carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  cursor: pointer;
}
.hs-carousel-dot.active {
  background: #fed500;
  width: 32px;
  border-radius: 6px;
}
@media (max-width: 1024px) {
  .hs-carousel-card {
    flex: 0 0 calc(50% - 12px);
  }
}
@media (max-width: 768px) {
  .hs-carousel-card {
    flex: 0 0 calc(100% - 24px);
  }
}
Javascript

FAQ

Is there a limit to how many cards I can add?

There is no hard technical limit; however, for the best user experience, it is generally recommended to keep the count between 5 and 10 cards.

Can I change the speed of the slide transitions?

Yes. You can customize the interval between slides by adjusting the specific timing values within the code.

Can I hide this section on specific devices?

Yes. By utilizing HubSpot’s standard "Visibility" settings, you can choose to show or hide the entire section for specific screen sizes, such as mobile-only or desktop-only.

Search

Search more

Related Template

Need Customization?

We can customize this sample to match your specific business requirements.

Book Free Consultation

Got a quick dev request?

Put it on Trello!Need a fix for HubSpot, CMS, or GAS? Post it on Trello.

Development Requests Here

HubSpot CMS: Implementing the Data Type Conversion Action

HubSpot CMS: Implementing a Professional "Pricing Table Module"

HubSpot CMS: Implementing the "Login Check & Redirect Module" for Secure Page Access

HubSpot CMS: Implementing the "Carousel Card Module" for Smart Content Organization

HubSpot CMS: Implementation Guide for Video Hero Banners (Video Above-the-Fold)

Company Info
Name : SweetsVillage .Inc
CEO :
‍
Tomoo Motoyama

HomeTemplateCustomWorkflow
Terms & ConditionsPrivacy PolicyContact us

Copyright ©SweetsVillage .Inc

Back To Top Image