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
      • BlogHighlights
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • CustomTable
      • Faq
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • Offer
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Quote
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
      • OrderReviews
      • ProductReviews
      • Newsletter
    • 3. Reusables
      • _Overview
      • Addresses
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • BillingRetail
      • BlogPostingStructuredData
      • BrandListStructuredData
      • CollectionStructuredData
      • Company
      • General
      • GroupChildrenTable
      • Login
      • LoginModal
      • MonthlyTransactions
      • Offers
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductAvailabilityAction
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductGridItemClassic
      • ProductListItem
      • ProductModal
      • ProductStructuredData
      • ProfileInfo
      • PromptModal
      • Quotes
      • Register
      • Services
      • Shipping
      • ShoppingLists
      • ShoppingListsButton
      • ShoppingListsNavbar
      • StoresStructuredData
      • Toast
      • Transactions
      • Users
      • VariantContent
      • VariantContentClassic
      • WishlistButton
      • ProductRating
      • ClientHelpers
      • FaqStructuredData
      • ShoppingAssistant
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • _Overview
        • theme.js
      • Css - Scss
        • _Overview
        • ThemeClasses
    • 5. SDK
      • _Overview
      • LiquidGlobals
      • ServicesSDK
  1. 2. Components

TopBar

Purpose#

The TopBar component renders the thin announcement bar at the top of the site header.
It:
renders announcement columns, each holding elements (text, optional link, optional image)
optionally animates an element as a typing effect or a marquee
optionally renders a language switcher dropdown (desktop) when enabled and more than one language exists
optionally renders a dark mode toggle button (desktop; disabled by default)
hides/shows itself on scroll (client-side)

Inputs (model contract)#

Model shape (storefront example)#

{
  "name": "TopBar",
  "view": "Default",
  "section": "SectionHeader",
  "settings": {
    "columns": [
      {
        "orientation": "Left",
        "elements": [
          {
            "text": "Sample text",
            "link": "/sample",
            "image": { "link": "/sample.png", "alt": "Sample alt" },
            "animation": "None",
            "alignment": "Left"
          }
        ]
      }
    ],
    "showLanguage": true,
    "id": "Component Id",
    "section": "SectionHeader",
    "type": "NoirTopBar",
    "name": "TopBar",
    "configuredInContentApi": true,
    "view": "Default",
    "displayName": "",
    "cssClass": "",
    "header": "",
    "alignment": "Left"
  },
  "translations": {
    "enableDarkMode": "Sample text",
    "disableDarkMode": "Sample text",
    "selectLanguage": "Sample text",
    "...": "..."
  }
}

Required fields#

settings.id

Optional fields#

settings.cssClass
settings.columns[] (each with orientation and elements[])
Language dropdown:
model.Settings.showLanguage (the token is lowercase in Liquid)
GlobalData.Company.Languages[] (must contain more than one language)
GlobalData.CurrentLanguage / GlobalData.Company.DefaultLanguage
translations.*
The template may also read from Root.Page.Data.

JavaScript#

Global object#

Components/TopBar/Default.js exposes topbardefault.initComponent().
Liquid binds it with x-data="topbardefault.initComponent()" and supplies data-sticky.
The Alpine component registers a passive scroll listener. With sticky disabled, it hides on
scroll down and reappears on scroll up or at page top. During the height transition, browser scroll anchoring is disabled. Scroll-range clamping at the bottom of the page is also excluded from upward direction detection. Sticky keeps it visible. Typing animations
type plain text in a loop (restarting after a short pause) and keep a complete accessible copy.
Marquee copies are inert so only the original links are focusable. The measured height is refreshed
when the content resizes. Destroying the component removes its scroll listener and clears
animation timers. The hide class is supplied by the theme styles.

Global Alpine stores (used by TopBar)#

Alpine.store("darkMode") (theme mode)#

The dark mode toggle uses a shared Alpine store:
$store.darkMode.toggle()
$store.darkMode.on (for aria-checked and styling)
Note: the template also binds to $store.darkMode directly.

Dependencies#

Alpine.js
Alpine stores:
darkMode
Liquid globals:
GlobalData.Company.Languages
GlobalData.CurrentLanguage
GlobalData.Company.DefaultLanguage

Notes#

Announcement columns render on every screen size, but on mobile only the first column and the first element of each column are shown.
The language dropdown and dark mode toggle render only on desktop (hidden lg:flex).
Language dropdown is rendered only when model.Settings.showLanguage is true and there are multiple languages.
Element text is Markdown converted to HTML by the storefront, so the backend is expected to provide safe HTML.

Extras#

Template behavior (Liquid + Alpine)#

Language dropdown uses local Alpine state (open) and supports Escape + click-away.
The current language label is derived from the first two characters of the language code.

Component settings#

ShowDarkMode (boolean, default false): display the dark mode switcher in this component.
The theme-wide ShowDarkMode setting must also be enabled.
Sticky (boolean, default false): keep the topbar visible within the sticky header while
scrolling. When disabled, hide on downward scroll and show on upward scroll or at page top.
Columns (array, default empty): ordered columns of announcement content.
Each column has Orientation (Left, Center, Right; default Left) and an Elements array.
Language and dark mode controls remain available alongside columns. The legacy text and link
properties are retained as backup data, but are not converted to columns or rendered by the
default storefront view. Configure Columns explicitly; migrate legacy page data into columns
before removing any compatibility process for existing pages.
Each element supports translated Text, optional Link, Image (the standard media item with
Link and Alt), Animation (None, Typing, Marquee; default None), and Alignment
(Left, Center, Right; default Left). A link wraps the element's image and text.
Typing types plain text in a loop; marquee scrolls text and pauses on hover or keyboard focus.
Both animations respect reduced motion. On mobile, columns stack and only the first column and
its first element are shown.
Modified at 2026-11-20 09:49:54
Previous
ThankYouPage
Next
Wishlist
Built with