Home
Wiki
Home
Wiki
  1. 2. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
    • 0. Introduction
    • 6. FAQ
    • 1. Structure
      • _Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • _Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Quote
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
    • 3. Reusables
      • _Overview
      • Addresses
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • BillingRetail
      • Company
      • General
      • Login
      • LoginModal
      • MonthlyTransactions
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductListItem
      • ProductModal
      • ProfileInfo
      • PromptModal
      • Quotes
      • Register
      • Services
      • Shipping
      • ShoppingLists
      • ShoppingListsButton
      • ShoppingListsNavbar
      • Toast
      • Transactions
      • Users
      • VariantContent
      • WishlistButton
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • _Overview
        • theme.js
      • Css - Scss
        • _Overview
        • ThemeClasses
    • 5. SDK
      • _Overview
      • LiquidGlobals
      • ServicesSDK
  1. 2. Components

BannerCarousel

Purpose#

The BannerCarousel component renders a responsive banner slider using Swiper.
It supports:
“full width” vs “container” rendering
multiple layout modes via columns
configurable height via bannerHeight
banners with:
background color
background image (desktop + mobile)
background video with fallback image
internal content blocks (“sets”) per slide

Inputs (model contract)#

Model shape (storefront example)#

{
  "name": "BannerCarousel",
  "view": "Default",
  "section": "SectionA",
  "settings": {
    "bannerExtended": true,
    "bannerHeight": "Standard",
    "columns": "One",
    "banners": [
      {
        "backgroundImage": {
          "id": "Image Id",
          "galleryId": "Gallery Id",
          "link": "https://example.com/sample",
          "mediaType": "Image"
        },
        "backgroundImageMobile": {
          "id": "Mobile image Id",
          "galleryId": "Mobile gallery Id",
          "link": "https://example.com/sample",
          "mediaType": "Image"
        },
        "sets": [
          {
            "backgroundColor": true,
            "alignment": "Left",
            "header": "Sample header",
            "text": "<p>Sample text</p>\n",
            "buttonText": "Sample button text",
            "buttonLink": "/sample"
          },
          ...
        ]
      },
      ...
    ],
    "id": "Component Id",
    "section": "SectionA",
    "type": "NoirBannerCarousel",
    "name": "BannerCarousel",
    "configuredInContentApi": true,
    "view": "Default",
    "displayName": "Sample display name",
    "cssClass": "Sample cssClass"
  },
  "translations": {
    "clickToLearnMoreAbout": "Sample translation",
    "bannerLink": "Sample translation",
    "...": "..."
  }
}

Required fields#

settings.id
Used to form deterministic ids:
wrapper: comp-{{ id }}
swiper container: banner-carousel-{{ id }}
settings.banners[]
Component renders only when banners exist and banners.length > 0.

Optional fields#

settings.cssClass
Appended when non-empty and not (UNDEFINED).
settings.bannerExtended (boolean)
true renders full width; otherwise it uses container.
settings.columns (string)
Controls layout modifiers and Swiper configuration.
Observed values in storefront example: One
Template also supports: Two, Three, Four, TwoThirdOneThird, OneThirdTwoThird.
settings.bannerHeight (string)
Observed value: Standard
Template also supports: Small, FullHeight.

JavaScript#

Global object#

The component exposes a global object:
It’s used from Liquid via Alpine:
x-data="bannercarouseldefault.initComponent('{{ id }}', '{{ columns }}')"
initComponent(...) returns the Alpine component state + methods and then boots Swiper.

initComponent#

Factory that returns Alpine state + handlers for banner carousel layout + Swiper init.
It provides:
state: id, columns, navbarHeight, topbarHeight, bannersHeight, isMobile
lifecycle: init()
helpers: getBannersHeight(), updateNavbarHeight(), updateTopbarHeight(), swiperInit(id, columns)
Notes:
id and columns are passed as strings from Liquid.

init#

Runs on Alpine mount.
It initializes banner height (via getBannersHeight()), wires a resize handler (with a small delay), and then initializes Swiper via swiperInit(this.id, this.columns).

getBannersHeight#

Computes bannersHeight differently for desktop vs mobile.
On desktop it uses window.innerHeight - topbarHeight - navbarHeight. On mobile it uses "auto".

updateNavbarHeight#

Reads .navbar height and stores it in navbarHeight.
Implementation summary:
Queries:
document.querySelector(".navbar")
If found:
this.navbarHeight = navbar.offsetHeight

updateTopbarHeight#

Reads .topbar height and stores it in topbarHeight.
Implementation summary:
Queries:
document.querySelector(".topbar")
If found:
this.topbarHeight = topbar.offsetHeight

swiperInit#

Initializes a Swiper instance on #banner-carousel-<id> with rules based on columns and on a “Small height” mode.
It computes slides-per-view/spacing based on columns, resolves the carousel DOM (container + pagination), decides whether looping is enabled based on slide count, and creates the Swiper instance.

Dependencies#

Swiper (CSS + JS)
Alpine.js

Notes#

If Swiper isn’t loaded, the carousel won’t behave as a slider (slides may appear stacked).
FullHeight mode depends on .topbar and .navbar being present; if those class names change, height calculation may become inaccurate.
Some banner items may contain empty sets ({}) by design.
Modified at 2026-05-11 14:50:39
Previous
Announcement
Next
BlogCategoryList
Built with