Web embed
<huesix-configurator> is a web component: it works in any page and
any framework, with nothing to build.
Try it
Our sample ring, live. Switch its attributes, run its methods and watch its events; the Code tab is the page you’d write for it, with the calls you ran.
Getting the workbench ready…
Put it on the page
Load the script once per page (in the <head> or anywhere before the
element is used), then put the element where the configurator goes:
<script type="module" src="https://www.huesix.com/embed/huesix.js"></script>
<huesix-configurator
src="https://www.huesix.com/studio/api/public/<workspace>/<product>/manifest.hxp"
></huesix-configurator>
The src is the product’s manifest address: copy it from Studio → your
product → Publish (or give it once on the
start page, and every example here uses it).
-
It shows the product’s poster at once and loads 3D as it nears the screen (
loading="eager"starts at once). -
It fills its container’s width. Its height follows the product’s Design step; set your
own with
--huesix-height: a fixed length like640pxor80vh, not a percentage (on phones the 3D view itself takes that height, and a percentage there has nothing to measure against). -
Point
srcat the manifest’s address itself (it ends in/manifest.hxp), not a copy of the file: it’s a huesix package, in huesix’s own signed format rather than JSON, and the player shows it only as huesix served it, for a week. A changed or hand-made one isn’t shown (“This configurator can’t be shown here”, with the reason in the console). - Several on one page are fine; each is its own configurator. Add and remove them at any time (in a single-page app too): removing one frees its 3D view.
- In React, use @huesix/react, or load the script in your layout and render the element like any other.
List your site first (Studio → Settings → Workspace → Sites, or Publish
→ Embed): configurators show only on the sites a workspace lists, and other sites get a
message that it isn’t available there. Listed sites cover their subdomains;
localhost, huesix’s own pages and the workspace’s own domain always work,
and a Shopify store you connect is listed for you.
A product’s models, texture maps and lighting are served encrypted: the player gets their keys from huesix only on the listed sites, so an embed copied elsewhere, or a changed copy of the player, can’t show them.
In an iframe instead
Where a site builder won’t take scripts, Studio’s Publish step gives an iframe of the product’s own page. It sends the page around it the same events as messages (without the shopper’s contact details):
addEventListener('message', (event) => {
if (event.origin !== 'https://www.huesix.com' || event.data?.source !== 'huesix') return;
// type: ready, change, add-to-cart, cta, enquiry, share, checkout or error
if (event.data.type === 'change')
console.log(event.data.detail.configuration.price.formatted);
});
An iframe can’t be told what to do (no methods), and its cart button can’t wait for your cart: use the element for that.
Size and style
Your site’s CSS wins over the product’s Design step:
huesix-configurator {
--huesix-height: 640px; /* the configurator's height */
--huesix-panel-width: 360px; /* the options panel beside the view */
--huesix-stage-ratio: 4 / 3; /* the view's shape where the panel is below it */
--huesix-radius: 16px; /* the frame's corners */
--hx-accent: #0b5cff; /* also --hx-accent-text */
--hx-text: #1a1a1a; /* also --hx-muted */
--hx-panel: #ffffff; /* also --hx-surface, --hx-border */
--hx-radius: 10px; /* buttons, options and cards */
--hx-font: 'Brand Sans', sans-serif; /* also --hx-heading-font, --hx-font-size */
}
/* Any piece by its part name */
huesix-configurator::part(option-selected) { outline: 2px solid #0b5cff; }
huesix-configurator::part(title) { text-transform: uppercase; }
Parts include root, stage, panel,
title, steps (the bar of groups’ tabs: each a
step, the open one also step-active), group,
group-title, option, swatch,
option-selected, option-unavailable, summary,
total, total-value, actions,
camera-views, toast and preloader. A frameless
product (data-frame="none"
on the element) has no line round it, so your page can follow:
huesix-configurator[data-frame="none"].
Attributes
| Attribute | What it does |
|---|---|
src |
The manifest’s address (a product’s or a collection’s). Changing it shows another product in the same place. |
config |
A share code to start from. Without it: a design shared to the page
(?o=…), else the product’s defaults.
|
language |
One of the product’s languages, like ar (right to left included).
Changing it switches in place.
|
cart |
An Add to cart button; your page answers huesix:add-to-cart.
cart="buy-now" words it Buy now.
|
headless |
Only the product: no panel and no buttons over the view. Your page draws every control (Your own controls). |
stage-only |
No panel, but the view keeps its own buttons (cameras, AR, full screen). Your page draws the options beside it. |
view |
3d, spin (360° pictures) or
stills (pictures): how it’s shown, over the product’s own choice. A
page address can ask the same with ?hx-view=.
|
loading="eager" |
Load at once, not as it nears the screen. |
poster |
A picture to show until 3D is ready, over the product’s own. |
share-url |
The page shared designs open on. The current page’s address when left out. |
interaction |
full: touches turn the product at once (swipes over the view don’t
scroll the page). scroll-friendly: swipes scroll the page until the
shopper taps the view. In both, the mouse wheel scrolls the page until the
view’s clicked. Without it, the product’s own setting.
|
xr="off" |
No AR or VR (nor their QR codes), even where the product offers them. Try-on stays. |
back |
A back button in the corner, which fires huesix:back for your page
to act on; back="close" draws it as a close button.
|
analytics-consent="false" |
Hold analytics until you set it to true (below).
|
analytics-endpoint |
Send analytics to your own address instead of huesix’s (Studio’s Analytics then shows nothing for this embed). An empty value sends none. |
designs-endpoint |
Where shared designs are saved and opened (below). Products published from Studio use huesix’s without it. |
tier |
Force a quality: ultra, high, standard,
low or image (pictures, no 3D). Normally it’s chosen
for the device.
|
renderer |
webgpu, webgl or webgl1, for testing.
Normally it’s chosen for the device. (huesix:ready reports WebGL 2
as webgl2.)
|
debug |
While you build: why it failed to start, with the stack, in the browser’s console. |
Changing src, language or analytics-consent on a
configurator already shown takes effect at once. Adding or removing cart,
headless or stage-only starts it again (it reloads, and the
shopper’s choices start over); switching cart to
cart="buy-now" needs it removed and added again. The others are read as it
starts.
Events
Events are dispatched on the element. They bubble out of it, so you can listen on the
document too. Each one’s details are in event.detail.
| Event | When, and its detail |
|---|---|
huesix:ready |
The first frame is on screen. { tier, renderer, timings } (timings.interactive
in ms). Fires again with restarted: true if the 3D view had to
restart.
|
huesix:progress |
{ progress }, 0 to 1, for a loader of your own. |
huesix:change |
A choice was made. { configuration, changed, autoChanges }:
changed is the option’s reference ('' when several
changed at once: setSelection, a look, undo, reset, a
personalisation), autoChanges what the product’s rules changed with
it. Not fired for the starting design: getConfiguration()
has that.
|
huesix:blocked |
A choice the rules don’t allow. { ref, reason }, the reason in the
shopper’s words.
|
huesix:add-to-cart |
The shopper asked to add it to the cart.
{ configuration, waitUntil }: pass your cart request to
waitUntil() and the button waits for it, then says it’s added, or
shows your error’s message. Call it straight away in the listener, not after an
await. With huesix checkout on, calling it (or
preventDefault()) keeps the shopper here instead of going to
checkout.
|
huesix:checkout |
huesix checkout only: the shopper is going to pay.
{ url, configuration }.
|
huesix:enquiry |
An enquiry form was sent.
{ enquiry, configuration, button, form, waitUntil }. Cancelable:
call preventDefault() to send it your own way, and pass your
request to waitUntil().
|
huesix:cta |
A button that opens a page was followed.
{ url, configuration, button }.
|
huesix:share |
A share link was made. { url }. |
huesix:save |
The design was saved for later. { configuration }. |
huesix:camera |
A camera view was chosen. { camera }. |
huesix:hotspot |
A point of interest was opened. { hotspot, tour }. |
huesix:xr |
AR or VR started, ended or isn’t supported. { mode, state }:
mode is ar, vr,
quick-look (AR on iPhone and iPad) or native (in the
app SDKs); state is started, ended or
unsupported.
|
huesix:xr-support |
Once 3D is up: { ar, vr }, whether each can start. |
huesix:tryon |
Try-on (the camera) started or ended. { on }. |
huesix:size |
The shopper found their ring or wrist size with try-on.
{ kind, mm, sizes } (sizes.us, uk,
eu, jp, or cm and in for a
wrist). estimated: true when the shopper skipped matching their
screen to a card, so the size is a rough guide: don’t choose a size for them
from it.
|
huesix:language |
Another language is shown. { language, dir }. |
huesix:collection-select
|
A collection: the shopper picked another of its products.
{ collection, item }. Cancelable, to show it your own way.
|
huesix:collection-change |
A collection shows another of its products.
{ collection, item, name, productId }.
|
huesix:open-group |
stage-only: something on the view (a hotspot, a part tapped) asks
for one of the option groups. { group }: open it in your panel.
|
huesix:dimensions, huesix:explode,
huesix:hotspots, huesix:present
|
Dimensions, the exploded view, the points of interest or a presentation shown or
hidden. { on }.
|
huesix:environment |
Other lighting was chosen. { environment }. |
huesix:animation |
An animation started. { animation, forward }. |
huesix:back |
The back button was pressed. |
huesix:analytics |
Every analytics event (below). |
huesix:error |
Something failed. { message, fatal }: fatal is
true when the configurator couldn’t start (nothing more happens
until it’s tried again). Not fatal: a collection’s product, AR or VR, checkout,
an enquiry, a saved picture, or 3D falling back to pictures.
|
const configurator = document.querySelector('huesix-configurator');
configurator.addEventListener('huesix:change', (event) => {
const { price, summary, shareCode } = event.detail.configuration;
document.querySelector('#total').textContent = price.formatted;
});
configurator.addEventListener('huesix:add-to-cart', (event) => {
const { shareCode, productId } = event.detail.configuration;
// The button waits; a rejection's message is shown to the shopper.
event.detail.waitUntil(
fetch('/cart/lines', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ productId, shareCode }),
}).then((r) => { if (!r.ok) throw new Error('That couldn’t be added. Try again.'); }),
);
});
The configuration
huesix:change, huesix:add-to-cart and
getConfiguration() give the configuration as it stands:
{
"productId": "solitaire-ring", // the manifest's id: its product
"version": 3, // the published version shown
"selection": { "metal": ["rose-gold"], "stone": ["diamond"] },
"summary": [{ "groupId": "metal", "group": "Metal",
"options": [{ "id": "rose-gold", "name": "Rose gold" }] }],
"priced": true, // false: explore only, don't sell it
"price": { "currency": "AED", "base": 4200, "lines": [],
"subtotal": 4200, "tax": 210, "total": 4410,
"display": 4410, "formatted": "AED 4,410.00" },
"bom": [{ "sku": "AUR-SOL", "name": "Aurelia Solitaire", "quantity": 1 }],
"leadTimeDays": 0,
"shareCode": "band*classic.metal*rose-gold.setting*solitaire.stone*diamond",
"shareUrl": "https://shop.example/rings/solitaire?o=Xw3k9Qp2LmZa", // see below
"files": [{ "id": "logo", "name": "Your logo", "url": "https://…" }] // logos only
}
price.display is the total as shown (with tax where the product shows
prices with tax). Show formatted; charge what the
quote API says. Keep shareCode to open
the design again (the config attribute): shareUrl
carries the design only once a share link has been made (the Share button), and is the
page’s own address until then.
Methods
Call them from a <script type="module"> after the huesix.js tag (or
after await customElements.whenDefined('huesix-configurator')). They return
promises that wait for the first frame on screen: with the default lazy loading, that’s
once the element nears the screen. await configurator.ready waits for the
same. If the product can’t load they don’t resolve: huesix:error
says so.
| Method | What it does, and resolves to |
|---|---|
select(ref) |
Chooses an option ('metal:rose-gold'), as a click would, rules and
all. true, or false when the rules don’t allow it or
there’s no such option (both fire huesix:blocked; an unknown
option’s reason is for you, not the shopper).
|
deselect(ref), toggle(ref) |
For groups where several can be chosen. false where a group needs a
choice.
|
setSelection(selection) |
Sets every group at once:
{ metal: ['rose-gold'], stone: ['ruby'] }. Groups left out are
emptied (required ones get their default) and personalisations left out are
cleared; the rules then apply. true, or false if it
can’t be made.
|
getConfiguration() |
The configuration. |
getState() |
Every group and option as a panel would draw it (its shape). It answers once the product is read, while the 3D view still loads; the methods that change the product wait for the view. |
setPersonal(id, value) |
Fills in a personalisation: { text, font?, color? }, or
null to empty it.
|
uploadPersonal(id, file) |
Puts a shopper’s logo (a File: PNG, JPEG, WebP or SVG, up to 5 MB)
where logos go. false for any other file. Products published from
Studio only (the logo’s kept beside the manifest).
|
applyLook(id) |
Starts from one of the product’s ready-made looks. |
undo(), redo(), reset() |
Back, forward again, or the starting configuration (which can be undone). |
setCamera(id) |
Moves to one of the product’s camera views (their ids: Studio, or the manifest’s
scene.cameras).
|
getView() |
Where the view is now: { yaw, pitch, distance, fov } (null
before it’s drawn).
|
snapshot(width?, height?) |
A PNG of the view, as a data: URL. |
addToCart() |
Fires huesix:add-to-cart, as the button does.
true once added (your waitUntil() promise resolved);
false if it rejected, the product isn’t priced, or a required
choice or logo is missing.
|
enterAr(), enterVr() |
Start AR or VR, as their buttons do (from a click: browsers ask for one). |
xrSupport() |
{ ar, vr }: whether this device can, to show AR and VR buttons of
your own.
|
setLanguage(code), getLanguage() |
Show another of its languages; the one shown. |
openHotspot(id), showHotspots(on),
startTour(play?)
|
Points of interest (ids in the manifest’s hotspots): open one
(null closes it), show them, tour them (it plays on by itself;
false: the shopper steps through it).
|
playAnimation(id, forward?) |
Plays one of its animations forward, or back to rest. |
setEnvironment(id) |
Other lighting (ids in the manifest’s scene.environments;
null: the product’s own).
|
setPaused(paused) |
true: draws nothing while it’s out of sight (several products kept
loaded, one shown at a time); loading goes on. false: draws again.
|
getExtras(), runAction(id) |
The panel’s notes (tax, made to order) and its buttons (a quote, a brochure, a page), and running one, for a panel of your own. |
collection(), showCollectionItem(item) |
A collection: its products and the one shown (null for a single
product, and until the manifest is in), and showing another.
|
trackConversion(kind, data?) |
Counts a conversion of your own (a checkout, a booking) against the configuration, in Studio’s Analytics. |
setAnalyticsConsent(consent) |
The same as the attribute. |
const configurator = document.querySelector('huesix-configurator');
await configurator.select('metal:rose-gold');
const { price, shareCode } = await configurator.getConfiguration();
// A picture for the cart line
const picture = await configurator.snapshot(600, 600);
document.querySelector('#thumb').src = picture;
TypeScript
@huesix/react’s types describe the element, its configuration, state and
events (HuesixConfiguration, HuesixState,
HuesixElement), and work without React:
import type { HuesixElement } from '@huesix/react';
const configurator = document.querySelector('huesix-configurator') as HuesixElement;
Collections
A collection’s manifest shows several products in one configurator, with a row to move
between them; each keeps its choices, and matching ones (the same metal) carry over.
Embed it like any product. huesix:add-to-cart’s
configuration.productId says which product the design is of: pass it to the
quote API (Carts and prices). For a
switcher of your own, cancel huesix:collection-select or call
showCollectionItem():
await configurator.ready;
const { items, shown } = configurator.collection();
for (const item of items) {
const button = document.createElement('button');
button.textContent = item.name;
button.onclick = () => configurator.showCollectionItem(item.id);
switcher.append(button);
}
Analytics and consent
Published configurators report what shoppers do to huesix, for each product’s Analytics page in Studio: views, interactions, options chosen, AR and VR, shares, enquiries, carts and load times. It’s built to need no consent banner:
- No cookies, and nothing stored on the shopper’s device for it.
- No IP address or browser details kept: a visitor is counted with a hash whose salt is replaced every day, so no one can be followed from one day to the next.
- Only what the configurator does, never what shoppers type: designs are counted without their engraving or logos.
- Browsers sending Global Privacy Control or Do Not Track aren’t counted at all.
- Kept 400 days. A workspace can turn it off in Studio → Settings.
To wait for your own cookie banner anyway, add analytics-consent="false".
Events wait in memory (up to 200, not sent, not stored) and go once you set it to
true; they’re dropped if the shopper leaves first.
myConsentBanner.onAccept(() => configurator.setAnalyticsConsent(true));
Every event is also dispatched to your page as huesix:analytics and, when
the page has Google Tag Manager, pushed to its dataLayer as
{ event: 'huesix_<type>', huesix: <the event> } (for example
huesix_option; full-quality becomes
huesix_full_quality), for GA4 under your own consent rules. An event:
{
"type": "option", // load, ready, full-quality, interact, option, look, camera,
// hotspot, gallery, share, save, print, cta, enquiry, xr,
// drive, conversion, language, tier, error, leave
"productId": "solitaire-ring",
"version": 3,
"session": "9f2c4a1b7e3d5c60", // 16 hex characters, new each time a configurator starts
"t": 5231, // ms since the page loaded
"data": { "ref": "metal:rose-gold", "price": 4410 }
}
With analytics-endpoint, your address gets them in batches (up to 50, every
5 seconds, and when the page is hidden or closed) as a POST of
{"events": [...]} with content type text/plain, sent with
sendBeacon. It needs no CORS answer.
Shared designs
A shopper’s Share link carries a short id (?o=Xw3k9Qp2LmZa); huesix keeps
the design. For a manifest you host yourself, either leave
designs-endpoint out (links then carry the share code itself:
?hx-<product id>=<code>) or run your own:
-
POST <endpoint>with{"product", "code"}answers{"id"}: 12 letters, digits,_or-. -
GET <endpoint>/<id>answers{"product", "code"}, or 404. A design of another product is ignored. -
It’s called from the shopper’s browser: allow your page’s origin and the
content-typeheader (CORS).
A package you already have
configurator.load(bytes, baseUrl) shows a package you’ve fetched yourself
instead of fetching src: the bytes its address served (await response.arrayBuffer()), as they are; its relative file addresses are read against baseUrl, the
address you fetched it from. Like src, it shows only what huesix served,
unchanged and within its week. Products published from Studio don’t need it.