Skip to content

Component Reference

All 16 production islands, grouped by function. Each entry documents the tag name, source file, purpose, hydration directive, events, public methods, and inheritance.

Cart

cart-drawer

Filetheme/frontend/islands/cart-drawer.js
Hydrationclient:idle
ExtendsHTMLElement
Events consumedcart:added, cart:updated (global, via listen())
Events dispatchedNone

The main cart drawer component. Listens for cart:added to re-render drawer contents and open. Listens for cart:updated to toggle the is-empty class. Manages focus trapping, overlay click-to-close, Escape key, and body scroll lock.

Key methods:

MethodDescription
open(triggeredBy?)Opens the drawer, traps focus, locks body scroll
close()Closes the drawer, restores focus to the trigger element
renderContents(sections)Parses Section Rendering API HTML and replaces drawer + icon bubble content
setHeaderCartIconAccessibility()Converts the cart icon link to a button with aria-haspopup="dialog"

cart-drawer-items

Filetheme/frontend/islands/cart-drawer-items.js
Hydrationclient:idle
ExtendsCartItems
Events dispatchedcart:updated (inherited from CartItems)

Extends CartItems with a different getSectionsToRender() that targets the drawer container (#CartDrawer) and icon bubble instead of the main cart page sections. All quantity update logic, live region announcements, and loading states are inherited.


cart-items

Filetheme/frontend/islands/cart-items.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedcart:updated (global)

Base cart management component. Listens for change events (debounced at 300ms) from child quantity-input elements. Calls the Shopify Cart Change API, re-renders sections, updates live regions for screen readers, and manages focus after DOM replacement.

Key methods:

MethodDescription
updateQuantity(line, quantity, name?)Sends quantity change to Shopify API, re-renders sections
updateLiveRegions(line, itemCount)Announces quantity changes to assistive technology
getSectionsToRender()Returns array of section IDs and selectors to re-render
enableLoading(line) / disableLoading()Toggles loading overlay on the affected line item

cart-remove-button

Filetheme/frontend/islands/cart-remove-button.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedNone (delegates to parent cart-items)

Simple button that removes a cart line item by calling the parent cart-items or cart-drawer-items component's updateQuantity() method with quantity 0.

WARNING

This component adds its click listener in the constructor rather than connectedCallback. It does not use AbortController cleanup. This is a known deviation from the standard pattern.


cart-note

Filetheme/frontend/islands/cart-note.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedNone

Wraps a textarea for cart notes. On change, sends the note value to the Shopify Cart Update API. Uses AbortController for both the event listener and the fetch call.


quantity-input

Filetheme/frontend/islands/quantity-input.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedchange (native, bubbles to parent cart-items)

Plus/minus buttons that increment or decrement a number input. Uses the native stepUp() and stepDown() methods on the input element. Dispatches a native change event that bubbles up to the parent cart-items component.

WARNING

This component adds its click listeners in the constructor rather than connectedCallback. It does not use AbortController cleanup. This is a known deviation from the standard pattern.

Product

product-form

Filetheme/frontend/islands/product-form.js
Hydrationclient:idle
ExtendsHTMLElement
Events consumedvariant:changed (local, via listen() on closest <section>)
Events dispatchedcart:added (global), cart:error (global)

Product add-to-cart form. Intercepts form submission, calls the Shopify Cart Add API, dispatches cart:added on success or cart:error on failure. Listens for variant:changed to update the submit button state (enabled, disabled/sold out, disabled/unavailable) and clear error messages.

If no cart drawer exists in the DOM, falls back to a full page redirect to the cart.

Key methods:

MethodDescription
onSubmitHandler(event)Handles form submission, calls Cart Add API
onVariantChanged(event)Updates button text and disabled state based on variant availability
handleErrorMessage(message?)Shows or hides the inline error message element

product-recommendations

Filetheme/frontend/islands/product-recommendations.js
Hydrationclient:visible
ExtendsHTMLElement
Events dispatchedNone

Dynamically loads product recommendations via fetch when the component enters the viewport. Reads the URL from data-url, fetches the section HTML, and replaces its own innerHTML with the response content.


variant-selects

Filetheme/frontend/islands/variant-selects.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedvariant:changed (local, bubbles)

Base variant selection component for <select> dropdowns. On change, determines the selected variant from embedded JSON data, updates the URL with history.replaceState, updates hidden form inputs in product-form, fetches and renders updated price HTML, and dispatches variant:changed.

Key methods:

MethodDescription
onVariantChange()Orchestrates the full update flow
updateOptions()Reads selected values from <select> elements
updateMasterId()Finds the matching variant in the JSON data
updateURL()Updates the browser URL with the variant ID
updateVariantInput()Sets the hidden input[name="id"] in the product form
renderProductInfo()Fetches section HTML and updates the price display
getVariantData()Parses the embedded application/json script tag

variant-radios

Filetheme/frontend/islands/variant-radios.js
Hydrationclient:idle
ExtendsVariantSelects
Events dispatchedvariant:changed (inherited)

Extends VariantSelects with a single override: updateOptions() reads the selected value from radio button fieldsets instead of <select> elements. All other behavior (URL update, price render, event dispatch) is inherited.

Filetheme/frontend/islands/sticky-header.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedNone

Scroll-aware header that hides on scroll down and reveals on scroll up. Uses an IntersectionObserver to measure header bounds, then applies Tailwind translate/sticky/transition classes via requestAnimationFrame.

Key methods:

MethodDescription
onScroll()Main scroll handler -- decides whether to hide, reveal, or reset
hide()Adds -translate-y-full and sticky classes
reveal()Removes translate, adds transition
reset()Removes all sticky/translate/transition classes

localization-form

Filetheme/frontend/islands/localization-form.js
Hydrationclient:visible
ExtendsHTMLElement
Events dispatchedNone

Language/country selector dropdown. Manages aria-expanded state, keyboard escape to close, click-outside to close, and focus-out behavior. On item click, sets a hidden input value and submits the form to change locale.

Key methods:

MethodDescription
toggleList()Opens or closes the dropdown list
hideList()Closes the dropdown and resets ARIA attributes
onItemClick(event)Sets the hidden input value and submits the form

details-disclosure

Filetheme/frontend/islands/details-disclosure.js
Hydrationclient:idle
ExtendsHTMLElement
Events dispatchedNone

Controls the open/close animation of a <details> element. Plays CSS animations when the detail opens and cancels them on close. Auto-closes when focus leaves the component.

Key methods:

MethodDescription
onToggle()Plays or cancels content animations based on open state
onFocusOut()Closes the disclosure when focus leaves the element
close()Removes the open attribute and updates aria-expanded

WARNING

This component adds its listeners in the constructor rather than connectedCallback. It does not use AbortController cleanup. This is a known deviation from the standard pattern.

Modals

details-modal

Filetheme/frontend/islands/details-modal.js
Hydrationvaries (depends on usage context)
ExtendsHTMLElement
Events dispatchedNone

Base modal class built on the <details> element. Provides focus trapping (via trapFocus / removeTrapFocus from a11y.js), Escape key handling, overlay click-to-close, and body scroll lock. Exported as default so child classes can import and extend it.

Key methods:

MethodDescription
open(event)Opens the details element, traps focus, locks body scroll
close(focusToggle?)Closes the modal, removes focus trap, restores scroll
isOpen()Returns whether the details element has the open attribute
onSummaryClick(event)Toggles open/close on summary click
onBodyClick(event)Closes when clicking outside or on the overlay

header-drawer

Filetheme/frontend/islands/header-drawer.js
Hydrationclient:media="(max-width: 1023px)"
ExtendsDetailsModal
Events dispatchedNone

Mobile navigation drawer. Extends DetailsModal with a custom open() that adds a menu-opening class for CSS animation, and a custom close() that waits 400ms via requestAnimationFrame before removing the open attribute (allowing CSS exit transitions to complete).


password-modal

Filetheme/frontend/islands/password-modal.js
Hydrationclient:idle
ExtendsDetailsModal
Events dispatchedNone

Password page modal. Extends DetailsModal with a single addition: if the form contains an input[aria-invalid="true"] (server-side validation error), the modal auto-opens in the constructor.

Inheritance Summary

HTMLElement
  +-- CartItems
  |     +-- CartDrawerItems
  +-- VariantSelects
  |     +-- VariantRadios
  +-- DetailsModal (exported default)
  |     +-- HeaderDrawer
  |     +-- PasswordModal
  +-- CartDrawer
  +-- ProductForm
  +-- ProductRecommendations
  +-- StickyHeader
  +-- LocalizationForm
  +-- CartNote
  +-- CartRemoveButton
  +-- QuantityInput
  +-- DetailsDisclosure

Further Reading