interact-ai

Basic usage (quick start)

import { Interact } from '@wix/interact';
import type { InteractConfig } from '@wix/interact';

const config: InteractConfig = {
  // config-props
};

Interact.create(config);
<script type="module">
  import { Interact } from 'https://esm.sh/@wix/interact@1.86.0';

  const config = {
    // config-props
  };

  Interact.create(config);
</script>

General guidelines (avoiding common pitfalls)

InteractConfig – Rules for authoring interactions (AI-agent oriented)

This configuration declares what user/system triggers occur on which source element(s), and which visual effects should be applied to which target element(s). It is composed of three top-level sections: effects, conditions, and interactions.

Global rules

Structure

Working with <interact-element>

<interact-element data-interact-key="my-button">
  <button id="my-button">Click me</button>
</interact-element>
import type { InteractConfig } from '@wix/interact';

const config: InteractConfig = {
  interactions: [
    {
      key: 'my-button', // matches data-interact-key
      trigger: 'hover',
      effects: [
        {
          // key omitted -> targets the source element ('my-button')
          // effect props go here (e.g., transition | keyframeEffect | namedEffect | customEffect)
        },
      ],
    },
  ],
};

For a different target element:

<interact-element data-interact-key="my-button">
  <button id="my-button">Click me</button>
</interact-element>

<interact-element data-interact-key="my-badge">
  <span id="my-badge">Badge</span>
</interact-element>
const config: InteractConfig = {
  interactions: [
    {
      key: 'my-button',
      trigger: 'click',
      effects: [
        {
          key: 'my-badge', // target is different than source
          // effect props (e.g., transition | keyframeEffect | namedEffect)
        },
      ],
    },
  ],
};

Effect rules (applies to both registry-defined Effect and inline Effect within interactions)

Authoring rules for animation payloads (namedEffect, keyframeEffect, customEffect):

Target resolution and list context

Reduced motion

For AI Agents: llms.txt