node package manager


Set properties in response to events in A-Frame


An A-Frame component to register event listeners that set properties. Replacement for old undocumented Declarative Events API.


The Event Set component can register multiple event handlers that set multiple properties. Use double-underscores (__) to namespace individual instances of the component:

<a-entity event-set__1="_event: click; material.color: red; scale: 2 2 2,
          event-set__2="_event: mouseentermaterial.color: blue">
Property Description Default Value
_event Event name. ''
_target Query selector if setting property on another entity. ''

_event and _target are prefixed with underscores to avoid name collisions if case another component has event or target properties. Any key-value property pairs provided beyond _event and _target will be what is set once the event is emitted.


Browser Installation

Install and use by directly including the browser files:

  <title>My A-Frame Scene</title>
  <script src=""></script> 
  <script src="^3.0.0/dist/aframe-event-set-component.min.js"></script> 
    <a-box color="green"
           event-set__1="_event: click; material.color: red; scale: 2 2 2"
           event-set__2="_event: mouseenter; material.color: blue"></a-box>

NPM Installation

Install via NPM:

npm install aframe-event-set-component

Then register and use.