Custom elements
Definition
A custom element is a browser-native component: a class registered against a hyphenated tag name, with lifecycle callbacks that run when the tag enters or leaves the document. It needs no framework and no build step. Shopify's Dawn is written this way, so any theme descended from Dawn inherits the pattern along with the markup.
Documented at MDN, using custom elements.
How We've Used It
The lifecycle is why we use them, more than the encapsulation. Anything that arrives as fetched HTML, a filtered grid, a re-rendered drawer, a quick-view panel, has to bind itself, and an element that connects as it's parsed does that with no re-initialization call from whatever replaced the DOM. So variant pickers, swatch registries, media galleries, compare drawers and bundle builders are elements first and scripts second, and the ones that extend Dawn's own classes keep the vendor behavior for everything we didn't override. It keeps the contract visible in the markup too. A tag name says what owns that subtree, which matters on a page where three vendors also want it.
Builds Using It
- Composable PDP block architecture — LUS Brands. The product section's interactive blocks are elements that bind themselves.
- Alt-text driven variant media gallery — LUS Brands. A gallery element that re-filters media when the variant changes.
- Vertical filter rail and mobile filter accordion — LUS Brands. Dawn's facet components extended rather than replaced.
- Color-accurate shade swatch picker — Nudestix. A swatch element reading a merchandiser-managed hex registry.
- Bundle and kit PDP template — Nudestix. The buy path is an element, so one template can render two different forms.
- Collection-template palette builder — Nudestix. One element owns the pick tray and the cart write for the whole collection page.
- Product-card hover video and a reusable deferred-media playback refactor — LUS Brands
- Collection grid card on a licensed theme: metafield merchandising, a badge precedence chain, a hover-swap swatch element and first-row loading hints — Three Ships
- Curl Quiz 3.0: a nine-step diagnostic quiz rendered entirely from Shopify metaobjects — LUS Brands
- Predictive search moved off Shopify onto an external search API with client-side templating — Nudestix
- Kids featured collection: a custom element that builds its Swiper on approach and wraps the theme's own product cards — LUS Brands
- Dawn media gallery hardened for hidden slides and deferred video — LUS Brands
- Mega-menu header with separate mobile menu and image blocks — Three Ships
- Mobile sticky add-to-cart bar mirrored from the real product form — LUS Brands
- Side-by-side product comparison drawer and modal table — Nudestix
- Subscription bundle grid with tiered unlock progress — Three Ships
- Shade swatch rendering and per-variant content payload — Nudestix
- Pill variant picker with merchandiser-named size labels — LUS Brands
- Responsive video hero with independent desktop/mobile sources and single-source-of-truth playback controls — LUS Brands
- Accessible play/pause web component for autoplaying hero video — Nudestix
- Tabbed mobile Shop menu with featured banner panel — Three Ships
- Themed host section for Shopify Forms app blocks — Three Ships
8 further gated builds use it; their pages follow.
Related Entities
- Liquid section schema and settings — what configures the markup they mount into.
- localStorage — where their state survives navigation.
- CSS custom properties — how they're themed without new classes.