Skip to content

Element Interactions Schema

Element interactions define event-driven behavior: when a trigger fires, an action is executed on a target. They are stored in the _interactions key inside any element’s settings object.

Interactions are a flat array of interaction items. Each item specifies a trigger event, the action to perform, and a target element or selector.

PropertyTypeDescription
idstring | integerUnique identifier for this interaction
triggerstringEvent that fires this interaction (see triggers below)
actionstringAction to perform (see actions below)
targetstringTarget reference ("self", element ID, or selector context)
targetSelectorstringCSS selector for the target element
delaystringDelay before executing the action (ms)
runOncebooleanIf true, the interaction fires only once

These properties apply depending on the chosen action:

PropertyTypeUsed with
animationTypestringstartAnimation (animation type)
animationIdstringstartAnimation (predefined animation ID)
animationDelaystringstartAnimation (animation delay)
animationDurationstringstartAnimation (animation duration)
jsFunctionstringjavascript (function name to call)
jsFunctionArgsarrayjavascript (arguments array: [{ jsFunctionArg: "value" }])
scrollToDelaystringscrollTo (delay before scrolling)
scrollToOffsetstringscrollTo (scroll offset in pixels)
scrollOffsetstringscroll trigger (scroll position threshold)
rootMarginstringenterView/leaveView (IntersectionObserver root margin)
templateIdstringTemplate ID reference
formIdstringForm element ID
ajaxQueryIdstringAJAX query element ID
offCanvasSelectorstringtoggleOffCanvas (offcanvas CSS selector)
toggleOffCanvasInfostringtoggleOffCanvas (info field)
filterElementIdstringQuery filter element ID
infoBoxIdstringInfo box element ID
loadMoreQuerystringloadMore (query element ID)
targetFormSelectorstringclearForm (form CSS selector)
actionAttributeKeystringsetAttribute/removeAttribute/toggleAttribute (attribute name)
actionAttributeValuestringsetAttribute/toggleAttribute (attribute value)
disablePreventDefaultbooleanDo not call preventDefault() on the trigger event
storageTypestringstorageAdd/storageRemove/storageCount (storage type)
popupContextIdstringPopup context ID
popupContextTypestringPopup context type
conditionsSepstringVisual separator for conditions UI
{
"_interactions": [
{
"id": "abc123",
"trigger": "click",
"action": "startAnimation",
"target": "self",
"animationType": "fadeIn",
"animationDuration": "500"
},
{
"id": "def456",
"trigger": "enterView",
"action": "show",
"target": "self",
"rootMargin": "0px 0px -100px 0px",
"runOnce": true
}
]
}

Element

  • click
  • mouseover
  • focus
  • blur
  • mouseenter
  • mouseleave
  • enterView
  • leaveView
  • animationEnd
  • ajaxStart
  • ajaxEnd
  • filterSubmitStart
  • filterSubmitEnd
  • formSubmit
  • copySuccess
  • copyFail
  • formSuccess
  • formError

Browser / Window

  • scroll
  • contentLoaded
  • mouseleaveWindow

Query filters

  • filterOptionEmpty
  • filterOptionNotEmpty

WooCommerce

  • wooAddedToCart
  • wooAddingToCart
  • wooRemovedFromCart
  • wooCartContentsChanged
  • wooUpdateCart
  • wooCouponApplied
  • wooCouponError
  • wooCouponRemoved
  • wooDynamicFragmentsRefreshed
  • wooCheckoutStepChanged

Popup templates add showPopup, hidePopup via the templateInteractionItem variant in template settings.

ActionDescription
showShow element
hideHide element
clickClick element
setTextSet text
setAttributeSet attribute
removeAttributeRemove attribute
toggleAttributeToggle attribute
toggleOffCanvasToggle offcanvas
loadMoreLoad more (Query loop)
loadMoreGalleryLoad more (Image gallery)
startAnimationStart animation
lottieLottie: Playback
scrollToScroll to
sliderPlaybackSlider playback
checkoutStepCheckout step
javascriptJavaScript (Function)
openAddressOpen address (Map)
closeAddressClose address (Map)
clearFormClear form
copyToClipboardCopy to clipboard
storageAddBrowser storage: Add
storageRemoveBrowser storage: Remove
storageCountBrowser storage: Count

Each interaction can optionally include sub-conditions that must be met before the action fires. These are stored in the interactionConditions array, with interactionConditionsRelation controlling whether conditions are combined with AND or OR logic.

PropertyTypeDescription
interactionConditionsarrayArray of interactionConditionItem objects
interactionConditionsRelationstring"and" or "or" (default: "and")
PropertyTypeDescription
conditionTypestringType of condition check
storageComparestringComparison operator for storage value
storageCompareValueanyValue to compare storage against
storageKeyanyBrowser storage key to check
idstring,integerid
{
"id": "abc123",
"trigger": "click",
"action": "show",
"target": "self",
"interactionConditions": [
{
"conditionType": "storage",
"storageKey": "user_preference",
"storageCompare": "==",
"storageCompareValue": "dark"
}
],
"interactionConditionsRelation": "and"
}