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

General

Purpose#

General is a theme-internal “style guide / UI playground” reusable.
It renders a tabbed interface with reference UI patterns (typography, colors, icons, buttons, form fields, tabs, pagination/navigation) and provides helper tools to copy Tailwind/markup snippets to the clipboard.
This is primarily meant for theme developers/designers, not end-users.

Where it's rendered#

No render site was found in the theme Liquid files.
This reusable can still be rendered manually for development/debugging purposes.

Inputs (Liquid render parameters)#

General doesn’t require parameters, but it can read a query param to select the initial tab.

Model shape (storefront example)#

Not applicable (this reusable doesn’t receive a platform model object).

Required fields#

None.

Optional fields#

params.tab (string)
Used to set the initial tab:
{% assign active_tab = params.tab | default: 'typography' %}
<section x-data="{ tab: '{{ active_tab }}' }" x-cloak>

Template behavior (Liquid + Alpine)#

Source: Reusables/General/Default.liquid.
Creates a tab list (typography, colors, icons, buttons, fields, tabs, pag-nav).
Tab panels are shown/hidden using Alpine-driven conditional classes.
Throughout the template the UI calls helper functions from generalreusabledefault, for example:
copy(...) to copy a class string.
copyFromSibling(...) to copy markup from a sibling element.
toggleGroup(...) to expand/collapse grouped rows.

Data contract (JS runtime)#

The runtime utilities live in generalreusabledefault (see Reusables/General/Default.js).
This reusable is not a single Alpine state object; instead it exposes a collection of stateless helpers plus small Alpine component factories (e.g. multiInputComponent(...)).

JavaScript#

Source: Reusables/General/Default.js.

Clipboard helpers#

copy(button, text)
Uses navigator.clipboard.writeText when available and secure.
Falls back to fallbackCopy(text).
fallbackCopy(text)
Uses the legacy document.execCommand('copy') path.
showCopiedFeedback(button)
Temporarily changes button text to Copied! and disables it.

HTML extraction helpers#

copyFromSibling(button, withAlpine = false, templateId = null)
Copies HTML either from:
a <template> by id, or
a sibling element marked with .tobecopied.
Optionally strips Alpine attributes.
stripAlpineAttrs(el)
Removes Alpine-specific attributes (x-*, @..., :...) from a cloned node.
decodeHtmlEntities(html)
Decodes HTML entities using a temporary <textarea>.
copyRawTemplate(button, id)
Copies raw template text content.

Typography/group toggling#

toggleGroup(groupName)
Shows/hides [data-group] rows for the selected group.

Color mixing tool#

generateMix(state)
Validates hex inputs (base, mix, target) and sets state.result to a color-mix(...) expression.
Supporting functions:
computeBasePercentage(baseHex, mixHex, targetHex)
hexToRgb(hex)
normalizeHex(hex)
clearErrors(state)

Multi-input (tags) component#

multiInputComponent(initialTags = [])
Returns an Alpine-ready object that manages tags and an input box.
Exposes:
addTag()
removeTag(index)
handleBackspace(event)

Global Alpine stores#

None.

Services / API calls#

None.

Dependencies#

Reusables/General/Default.liquid
Reusables/General/Default.js
Reusables/General/Default.json (translations)
Browser Clipboard API (navigator.clipboard) with a fallback.

Notes#

This reusable may be intentionally not wired into the storefront; it’s primarily a development tool.
Some behaviors depend on window.isSecureContext (Clipboard API) and may behave differently on HTTP vs HTTPS.

How to preview it live (one-time setup)#

If you want to see General rendered in the storefront (for development), you can host it inside a custom “global-data style” component:
Create a custom component based on any existing global-data component (e.g. TextWithImage).
Name it custom_generalcomponents (for consistency).
In the host component’s Default.liquid, render only:
{% render 'Reusables\\General\\Default' %}
Add that component once in the “Components” page (or any internal dev page) so you can preview it.
Note: TextWithImage is just an example host; any suitable component works.

Why this exists#

This reusable is meant to be a central place for “packed” patterns/snippets for quick copy-paste (events, modals, guards, UI patterns, small utilities), so you don’t have to hunt across many components to find a specific pattern.

Examples#

Manual render (for development):
{% render 'Reusables\\General\\Default' %}
Open a specific tab (via query param):
?tab=icons
?tab=buttons
?tab=pag-nav
Modified at 2026-04-14 13:18:56
Previous
Company
Next
Login
Built with