Creates or debugs Bricks element interactions: trigger-action pairs for clicks, hovers, scrolls, form events, and WooCommerce cart changes. Covers inherited class actions, targets, callbacks, and frontend behavior.
Ships in bricks. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Interactions are the no-code behavior system: { trigger, action } pairs that wire clicks, hovers, scrolls, and form events to DOM mutations, popup opens, offcanvas toggles, and JS callbacks. Element-level interactions are stored on element.settings._interactions as an array. Global classes can also store _interactions, and every element using that class inherits those rows at render time.
Storage key: _interactions on element.settings or on a global class setting object. Array of objects. Each object has fields from includes/interactions.php:138-607: 30+ possible keys, most conditional on the trigger/action combination.
The update-element-interactions ability writes only element-level rows. It generates missing row IDs and validates trigger, action, target, JavaScript callback references, and action/trigger-specific required fields before saving.
Minimum shape:
{
"id": "abc123",
"trigger": "click",
"action": "show",
"target": "custom",
"targetSelector": "#my-modal"
}
Authoritative list at includes/abilities/interactions.php (Interactions::TRIGGERS), sourced from includes/interactions.php controls. Popup template interactions add two template-only triggers, showPopup and hidePopup, under template_interactions.
| Trigger | Fires when |
|---|---|
click | Element clicked |
mouseover | Pointer over |
mouseenter | Pointer enters bounding box |
mouseleave | Pointer leaves bounding box |
focus | Element focused (keyboard/tab) |
blur | Focus lost |
scroll | Page scrolled (configurable %/px) |
contentLoaded | DOM ready |
mouseleaveWindow | Exit-intent: pointer exits top of window |
enterView | Element enters viewport |
leaveView | Element leaves viewport |
animationEnd | CSS animation completes |
formSubmit | Form submitted (any form) |
formSuccess | Form submitted + server returned success |
formError | Form returned error |
ajaxStart | Query AJAX loader started |
ajaxEnd | Query AJAX loader completed |
filterSubmitStart | Query filter submit started |
filterSubmitEnd | Query filter submit completed |
Feature-scoped triggers (same const, also accepted by MCP):
filterSubmitStart, filterSubmitEnd, filterOptionEmpty, filterOptionNotEmptywooAddedToCart, wooAddingToCart, wooRemovedFromCart, wooUpdateCart, wooCartContentsChanged, wooCouponApplied, wooCouponRemoved, and wooCouponError on Bricks 2.5+copySuccess, copyFail, fired after a copyToClipboard actionwooCartContentsChanged listens for bricks/woocommerce/cart-contents-changed,
so use it for behavior that must respond to Bricks cart-content updates. The frontend
also handles wooDynamicFragmentsRefreshed and wooCheckoutStepChanged, but the
2.4 interaction ability's allow-list does not admit those two values. Do not infer
ability support merely from frontend JavaScript; check the target site's schema.
Authoritative list at includes/abilities/interactions.php:74-98 (Interactions::ACTIONS).
| Action | What it does | Extra keys |
|---|---|---|
show | Unhide target, or open a popup when target: "popup" | None, or templateId when target: "popup" |
hide | Hide target, or close a popup when target: "popup" | None, or templateId when target: "popup" |
click | Programmatic click on target | None |
startAnimation | Trigger a CSS animation | animationType, animationDuration, animationDelay |
scrollTo | Scroll to target | scrollToOffset, scrollToDelay |
setAttribute | Add/set attribute on target | actionAttributeKey, actionAttributeValue |
removeAttribute | Remove attribute | actionAttributeKey |
toggleAttribute | Toggle attribute presence or value | actionAttributeKey, actionAttributeValue |
toggleOffCanvas | Open/close an offcanvas element | offCanvasSelector |
loadMore | Load next page on a query loop | loadMoreQuery |
loadMoreGallery | Same, for image galleries | loadMoreTargetSelector |
openAddress | Open a map info box | infoBoxId plus map element context |
closeAddress | Close a map info box | infoBoxId plus map element context |
clearForm | Reset form fields | targetFormSelector unless the trigger is a form event |
storageAdd | Write to browser storage | storageType, actionAttributeKey, actionAttributeValue |
storageRemove | Remove from browser storage | storageType, actionAttributeKey |
storageCount | Increment a counter in browser storage | storageType, actionAttributeKey |
javascript | Call a named JavaScript function on window | jsFunction, optional jsFunctionArgs |
setText (2.5+) | Replace the target's text | actionText |
copyToClipboard (2.5+) | Copy custom text or an element's text | copySource (custom or element), copyText or copySelector |
sliderPlayback (2.5+) | Pause, resume or toggle a nestable slider's autoplay | sliderPlaybackAction (pause, resume, toggle); target the slider with a CSS selector |
lottie (2.5+) | Control a Lottie element | lottieAction (play, pause, toggle, stop, restart); target the Lottie element or an element containing one |
There is no openPopup, customJs, or inline javascript source field. The javascript action calls an existing frontend function by name through jsFunction (for example MyApp.trackCardClick) and optional jsFunctionArgs; it does not evaluate arbitrary JavaScript text. To open a popup with native interaction data, use action: "show", target: "popup", and templateId. JavaScript can still call bricksOpenPopup(id), but use the native shape when authoring Bricks data.
For jsFunctionArgs, each argument row needs jsFunctionArg and an id. The MCP writer generates missing IDs. Without IDs, the frontend skips the argument row.
Defined at includes/abilities/interactions.php (Interactions::TARGETS). MCP accepts exactly these three explicit values: self, custom, popup. If target is omitted, Bricks treats the interaction as self at runtime. Offcanvas open/close is saved as action: "toggleOffCanvas"; during render Bricks rewrites it internally to an offcanvas target for frontend handling.
| Mode | Setting | Resolves to |
|---|---|---|
self | target: "self" | The element that owns the interaction |
custom | target: "custom", targetSelector: "#foo" or .bar | CSS selector (querySelector semantics) |
popup | target: "popup", templateId: 123 | A popup template id |
Use CSS selectors for custom targets. To target a specific Bricks element by id, use #brxe-{element_id} only when the target element has no custom CSS ID. If the target has _cssId, Bricks renders that custom ID on the frontend instead, so target the custom selector (for example #hero-panel). If you rely on the auto id, the selector also breaks if the element is duplicated (new id).
Safer: add a CSS class to the target via the Element ID/Class panel (e.g. .js-main-nav), then target .js-main-nav from the interaction. Survives element duplication.
Interactions can live on a global class (same place as the class's other settings). Every element using that class inherits the interactions (Interactions::get_global_class_interactions() in includes/interactions.php).
Merge rule: interactions on an element stack with (do not override) interactions on the element's applied classes. So if a button has click -> show #foo and the button also has a class with click -> scrollTo #top, both fire on click.
Edit the global class to change inherited interactions.
MCP readback exposes this explicitly:
interactions: element-level rows only.inheritedInteractions: grouped global-class rows.effectiveInteractions: flattened frontend order, with source, sourceId, and sourceName on each row.enterView -> startAnimation on a scroll-repeating element. If the animation moves the element out of then back into view, it re-fires. Add Run once on the interaction.
click -> click on another element that clicks back. Infinite click loop. Happens often with "link both of these" logic. Add a guard or use a different mechanism.
Every interaction has a Run once boolean (runOnce) and optional interaction conditions (interactionConditions, defined in includes/interactions.php) based on browser storage:
windowStorage: page-load countersessionStorage: tab-lifetime counterlocalStorage: cross-session counterWith compare operators: exists, notExists, ==, !=, >=, <=, >, <.
Example: "fire at most 3 times across sessions": add a condition against a local-storage key, then pair it with storageCount using storageType: "localStorage" and the same key in actionAttributeKey.
Every interaction adds:
data-interactions attribute (shipped inline per element).Profile pages with repeated interactive elements before changing their behavior.
jsFunction.Few dedicated interaction hooks exist. For render-attribute level tweaks, use the element-render hooks (bricks/element/render_attributes). For popup-related interaction behavior, use bricks/popup/attributes.
Interactions are largely frontend-only. WPML-aware behavior for popup interactions is handled at includes/interactions.php:821-864, 954-983 (popup template id translation).
Interaction doesn't fire?
a. DevTools Elements -> find the element -> check data-interactions attribute. Is your interaction in the JSON? No -> saved state doesn't match builder. Resave.
b. Check browser console for errors. For JavaScript actions, verify that the named function exists on window and inspect callback errors.
c. Trigger mismatch: click on a disabled button, scroll on a non-scrolling container.
Interaction fires but target isn't affected?
a. Target selector is wrong. Test document.querySelectorAll("your-selector") in the console.
b. Target doesn't exist yet at trigger time (e.g., targeting an element inside a popup before the popup renders).
Fires too many times?
a. Class-level interaction duplicating element-level. Check the applied classes.
b. Missing runOnce. Enable it.
c. One of the infinite-loop traps above.
Fires on wrong elements?
a. Selector too broad. .btn matches every button on the page.
b. Global class interaction applies to more elements than you expected.
Works in builder, fails on frontend (or vice versa)?
a. Interaction references a popup template id that doesn't render in the builder context.
b. Trigger is a frontend-only event (formSubmit): builder doesn't submit real forms.
get-element-interactions: read element-level rows, inherited global-class rows, and flattened effective rows.update-element-interactions: replace element-level rows on an element. It validates element-level triggers only, generates missing row IDs, and never mutates inherited global-class rows. Popup template-level showPopup and hidePopup live in popup template settings as template_interactions.Use formSuccess for actions that require a successful submission. Enable runOnce when the action should stop after its first matching event.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/bricks:bricks-interactionsfrom bricks
npx claudepluginhub codeerhq/bricks-skills --plugin bricks46 skills in this plugin
/bricks-agent-repositoryHandle complex existing-site Bricks edits through advertised repository/workspace workflows when focused abilities cannot express the change./bricks-ai-tabDiagnose Bricks AI connection setup, ability toggles, dispatcher availability and disabled actions. Use for connection/availability problems./bricks-audit-design-systemAudit Bricks classes, variables, palettes and components, or carry out requested cleanup. Report-only audits do not authorize fixes.Other plugins' skills for the same job