Home
Wiki
Home
Wiki
  1. 3. Reusables
  • 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
    • 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
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
    • 3. Reusables
      • Overview
      • Addresses
      • BillingRetail
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • Company
      • General
      • Login
      • LoginModal
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductListItem
      • ShoppingListsButton
      • ProductModal
      • ProfileInfo
      • PromptModal
      • Register
      • Shipping
      • ShoppingLists
      • ShoppingListsNavbar
      • Toast
      • Users
      • VariantContent
      • WishlistButton
      • Services
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • Overview
        • theme.js
      • Css / Scss
        • Overview
        • ThemeClasses
    • 5. SDK
      • Overview
      • LiquidGlobals
      • ServicesSDK
  1. 3. Reusables

BackToTop

Purpose#

BackToTop is a theme-level floating button that appears after the user scrolls down the page, and smoothly scrolls the viewport back to the top when clicked.
It’s rendered globally from the main layout, so it’s available on all pages using Structure/LayoutA.liquid.

Where it's rendered#

In Structure/LayoutA.liquid:
{% render 'Reusables\\BackToTop\\Default' %}

Inputs (Liquid render parameters)#

BackToTop is rendered without parameters.

Model shape (storefront example)#

Not applicable (this reusable doesn’t receive a model object and has no Liquid parameters).

Required fields#

None.

Optional fields#

None.

Template behavior (Liquid + Alpine)#

Source: Reusables/BackToTop/Default.liquid.
Uses an Alpine data object:
<div x-data="backtotopreusabledefault">
Renders a fixed-position button at the bottom-right.
Button is shown/hidden via Alpine:
x-show="visible"
x-transition
Click handler:
@click="scrollToTop()"
Text + aria-label come from translations:
Reusables.BackToTop.Translations.BackToTopAriaLabel
Reusables.BackToTop.Translations.BackToTopText

Data contract (JS runtime)#

The Alpine object is defined as backtotopreusabledefault in Reusables/BackToTop/Default.js.
State:
showAfter (number | null)
Scroll threshold (in pixels) after which the button becomes visible.
visible (boolean)
Bound to x-show.

JavaScript#

Source: Reusables/BackToTop/Default.js.

init()#

Computes a default threshold if showAfter is not set:
this.showAfter = window.innerHeight / 3;
Registers a passive scroll listener that toggles visibility:
this.visible = window.scrollY > this.showAfter;

scrollToTop()#

Smoothly scrolls to the top of the page:
window.scrollTo({ top: 0, behavior: "smooth" });

Global Alpine stores#

None.

Services / API calls#

None.

Dependencies#

Reusables/BackToTop/Default.liquid
Reusables/BackToTop/Default.js
Reusables/BackToTop/Default.json (translations)
Structure/LayoutA.liquid (render site)

Notes#

Because it is rendered from LayoutA, it’s present across the entire storefront (unless the layout changes).
If you need the button to appear earlier/later, the JS supports adjusting showAfter (it’s a property on the Alpine object). Currently there’s no Liquid parameter that sets it.

Examples#

Global render (Layout):
{% render 'Reusables\\BackToTop\\Default' %}
Modified at 2026-04-14 13:18:56
Previous
AnnouncementModal
Next
Company
Built with