AR Button/QR Modal

Attributes

Attribute Type Default Value Description

sku

string

sets the sku corresponding to the epigraph experience

button-mode

string

"mobile desktop"

sets the AR button modes:
"none" - disable the AR button
"mobile" - enables the AR button only for mobile devices
"desktop" - enables the AR button only for desktop
"mobile desktop - enables the AR button for desktop and mobile

ar-button-rollover-nudge

boolean

false

toggles the ability to show a rollover nudge upon hover (only functional in button only mode, see the Standalone AR Button Example)

Attribute Example

This example sets the sku and button-mode attributes of the AR Button:

<epigraph-ar
	sku="INSERT-SKU"
	button-mode="mobile desktop"
></epigraph-ar>

CSS Custom Properties

PropertyWeb ComponentDescription
--ar-button-active-background-colorAR Buttonedits ar-button background color when clicked
--ar-button-background-colorAR Buttonedits ar-button background color
--ar-button-border-colorAR Buttonedits ar-button border color
--ar-button-hover-background-colorAR Buttonedits ar-button background color when hovered
--ar-button-hover-text-colorAR Buttonedits ar-button text color when hovered
--ar-button-text-colorAR Buttonedits ar-button text color
--ar-icon-frame-colorAR Buttonedits ar-icon frame color
--ar-icon-hover-frame-colorAR Buttonedits ar-icon frame color when hovered
--ar-icon-hover-vector-1-colorAR Buttonedits ar-icon vector 1 (top face) color when hovered
--ar-icon-hover-vector-2-colorAR Buttonedits ar-icon vector 2 (left face) color when hovered
--ar-icon-hover-vector-3-colorAR Buttonedits ar-icon vector 3 (right face) color when hovered
--ar-icon-vector-1-colorAR Buttonedits ar-icon vector 1 (top face) color
--ar-icon-vector-2-colorAR Buttonedits ar-icon vector 2 (left face) color
--ar-icon-vector-3-colorAR Buttonedits ar-icon vector 3 (right face) color
--qr-modal-close-button-stroke-colorQR Modaledits qr-modal close button stroke color
--qr-modal-done-button-active-background-colorQR Modaledits qr-modal done button background color when clicked
--qr-modal-done-button-background-colorQR Modaledits qr-modal done button background color
--qr-modal-done-button-border-colorQR Modaledits qr-modal done button border color
--qr-modal-done-button-hover-background-colorQR Modaledits qr-modal done button background color when hovered
--qr-modal-done-button-hover-text-colorQR Modaledits qr-modal done button text color when hovered
--qr-modal-done-button-text-colorQR Modaledits qr-modal done button text color
--qr-modal-instruction-colorQR Modaledits qr-modal instruction text color
--qr-modal-r--qr-modal-requirement-colorQR Modaledits qr-modal requirement text color
--qr-modal-title-colorQR Modaledits qr-modal title text color

CSS Custom Property Example

This example sets the AR button active background color custom property to blue:

epigraph-ar {
     --ar-button-active-background-color: blue;
 }

CSS Shadow Parts

Shadow PartWeb ComponentDescription
ar-button-containerAR Buttonpoints to the AR button container
default-ar-buttonAR Buttonpoints to the default AR button
ar-button-rollover-nudgeAR Buttonpoints to the AR button rollover nudge (if enabled)
qr-modalQR Modalpoints to the <qr-modal element
qr-modal-backgroundQR Modalpoints to the QR Modal background
qr-modal-close-defaultQR Modalpoints to the default close button in the QR Modal
qr-modal-containerQR Modalpoints to the main modal container
qr-modal-done-defaultQR Modalpoints to the default done button in the QR Modal
qr-modal-instruction-defaultQR Modalpoints to the default instructions in the QR Modal
qr-modal-qr-containerQR Modalpoints to the QR image container within the QR Modal
qr-modal-qr-imageQR Modalpoints to the QR image in the QR Modal
qr-modal-requirement-defaultQR Modalpoints to the default requirements in the QR Modal
qr-modal-title-defaultQR Modalpoints to the default title in the QR Modal

CSS Shadow Part Example

This example sets the width and height of the ar-button-container CSS shadow part to 100px:

epigraph-ar::part(ar-button-container) {
    width: 100px;
  	height: 100px;
}

Slots

SlotWeb ComponentDescription
ar-buttonAR Buttonreplaces the ar-button but maintains the onclick function
ar-button-rollover-nudgeAR Buttonreplaces the nudge section that appears on hover (if enabled)
qr-modal-closeQR Modalreplaces the QR Modal close button
qr-modal-doneQR Modalreplaces the QR Modal done button
qr-modal-instructionQR Modalreplaces the QR Modal instructions
qr-modal-requirementQR Modalreplaces the QR Modal requirements
qr-modal-titleQR Modalreplaces the QR Modal title

Slot Example

This example sets the ar-button slot to a new button element:

<epigraph-ar>
     <button slot="ar-button"></button>
</epigraph-ar>

Events

EventTypeDescription
epigraph-ar-capability-determinedCustomEvent<{ canActivateAr: any; }>custom event to indicate whether the device is AR capable
epigraph-ar-model-loadedcustom event to bubble up the model loaded event from model-viewer
epigraph-ar-loading-errorCustomEvent<{ message: any; stack: any; }>custom event to bubble up the model load error event from model-viewer, inheriting message and stack
qr-modal-requested-errorcustom event that sends if an error was received when requesting a QR code

Event Usage Example

This example listens for the epigraph-ar-model-loaded event on the first instance of epigraph-ar on your page:

let arElement = document.querySelector('epigraph-ar');
arElement.addEventListener('epigraph-ar-model-loaded', (e) => {
  console.log('Model Loaded');
});

What’s Next