---
title: "proto.interaction.add: Add interaction — Design kit command — Kition"
description: "Adds a prototype interaction to a layer: a trigger (click, hover, drag, key, delay and more), actions and a transition."
canonical: "https://developer.kition.ai/docs/kits/design/commands/proto.interaction.add"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/design/commands/proto.interaction.add](https://developer.kition.ai/docs/kits/design/commands/proto.interaction.add)

# proto.interaction.add

**Add interaction.** Adds a prototype interaction to a layer: a trigger (click, hover, drag, key, delay and more), actions and a transition.

- Kit: Design 0.1.0 (.kdesign); reference: [Design kit commands](https://developer.kition.ai/docs/kits/design.md)
- Changes the document: yes
- Acts on: `ids` (a list of ids), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | `object` | no | The action it runs: {type, …} as the notes say: {id?, ids?, trigger? {type: onClick\|onHover\|onPress\|onDrag\|mouseEnter\|mouseLeave\|mouseDown\|mouseUp\|afterDelay {ms}\|keyPress {key (a key or a combination: Shift+K, Ctrl+Alt+Delete; or a controller button: Gamepad A\|B\|X\|Y\|LB\|RB\|LT\|RT\|View\|Menu\|LS\|RS\|Up\|Down\|Left\|Right\|Home)}}, action?: {type: navigate {preserveScroll?}\|back\|scrollTo {offset? [x, y] (where the layer ends up from the top-left)}\|openOverlay {position?, anchor? screen\|triggerInside\|triggerOutside (default screen; the trigger ones measure the position preset on the layer that opens the overlay: outside puts top presets above it and bottom presets below it, edges lined up), offset? [x, y] (position manual: the overlay's top-left from the top-left of the layer that opens it; without it, right below that layer), close_on_outside? (default true), background?}\|swapOverlay\|closeOverlay\|openUrl {url}\|changeTo\|setVariable {variable, value \| expression (text, e.g. "count + 1")}\|setVariableMode {collection, mode}\|conditional {blocks [{condition? \| expression? (text, e.g. "count >= 3"), actions}]}, dest?}, actions? [..], transition? {type: instant\|dissolve\|smartAnimate\|moveIn\|moveOut\|push\|slideIn\|slideOut, direction?: left\|right\|top\|bottom}, durationMs?, easing? linear\|easeIn\|easeOut\|easeInOut\|easeInBack\|easeOutBack\|easeInOutBack\|gentle\|quick\|bouncy\|slow\|{customBezier {x1, y1, x2, y2}}\|{customSpring {mass, stiffness, damping}}}, delayMs? (mouse enter, leave, down and up: how long after the gesture the actions run, up to 600000), dest? (a frame id: with id alone, a click that navigates there)} — or {id, dest} for a click-navigate. Returns {index} |
| `actions` | `object[]` | no | Several actions, in order (instead of action). |
| `delayMs` | `number` | no | Mouse enter, leave, down and up: how long after the gesture the actions run, up to 600000. |
| `dest` | `integer` | no | A frame id: with id alone, a click that navigates there. |
| `durationMs` | `number` | no |  |
| `easing` | `"linear" \| "easeIn" \| "easeOut" \| "easeInOut" \| "easeInBack" \| "easeOutBack" \| "easeInOutBack" \| "gentle" \| "quick" \| "bouncy" \| "slow" \| object` | no | A named easing, or {customBezier {x1, y1, x2, y2}} or {customSpring {mass, stiffness, damping}}. |
| `id` | `integer` | no | The layer the interaction is on (default the selection). |
| `ids` | `integer[]` | no | The layers it goes on, each its own interaction (instead of id; default the selection). |
| `transition` | `object` | no | {type: instant\|dissolve\|smartAnimate\|moveIn\|moveOut\|push\|slideIn\|slideOut, direction?: left\|right\|top\|bottom}. |
| `trigger` | `object` | no | What starts it: {type: onClick\|onHover\|onPress\|onDrag\|mouseEnter\|mouseLeave\|mouseDown\|mouseUp\|afterDelay {ms}\|keyPress {key}} (default onClick). |

## Call through design_run

```text
design_run {
  "path": "<file>.kdesign",
  "steps": [{ "command": "proto.interaction.add" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `action`, `actions`, `delayMs`, `dest`, `durationMs`, `easing`, `id`, `ids`, `transition`, `trigger`. design_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "action": {
      "additionalProperties": true,
      "description": "The action it runs: {type, …} as the notes say: {id?, ids?, trigger? {type: onClick|onHover|onPress|onDrag|mouseEnter|mouseLeave|mouseDown|mouseUp|afterDelay {ms}|keyPress {key (a key or a combination: Shift+K, Ctrl+Alt+Delete; or a controller button: Gamepad A|B|X|Y|LB|RB|LT|RT|View|Menu|LS|RS|Up|Down|Left|Right|Home)}}, action?: {type: navigate {preserveScroll?}|back|scrollTo {offset? [x, y] (where the layer ends up from the top-left)}|openOverlay {position?, anchor? screen|triggerInside|triggerOutside (default screen; the trigger ones measure the position preset on the layer that opens the overlay: outside puts top presets above it and bottom presets below it, edges lined up), offset? [x, y] (position manual: the overlay's top-left from the top-left of the layer that opens it; without it, right below that layer), close_on_outside? (default true), background?}|swapOverlay|closeOverlay|openUrl {url}|changeTo|setVariable {variable, value | expression (text, e.g. \"count + 1\")}|setVariableMode {collection, mode}|conditional {blocks [{condition? | expression? (text, e.g. \"count >= 3\"), actions}]}, dest?}, actions? [..], transition? {type: instant|dissolve|smartAnimate|moveIn|moveOut|push|slideIn|slideOut, direction?: left|right|top|bottom}, durationMs?, easing? linear|easeIn|easeOut|easeInOut|easeInBack|easeOutBack|easeInOutBack|gentle|quick|bouncy|slow|{customBezier {x1, y1, x2, y2}}|{customSpring {mass, stiffness, damping}}}, delayMs? (mouse enter, leave, down and up: how long after the gesture the actions run, up to 600000), dest? (a frame id: with id alone, a click that navigates there)} — or {id, dest} for a click-navigate. Returns {index}",
      "type": "object"
    },
    "actions": {
      "description": "Several actions, in order (instead of action).",
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array"
    },
    "delayMs": {
      "description": "Mouse enter, leave, down and up: how long after the gesture the actions run, up to 600000.",
      "type": "number"
    },
    "dest": {
      "description": "A frame id: with id alone, a click that navigates there.",
      "type": "integer",
      "x-khp-types": [
        "Node"
      ]
    },
    "durationMs": {
      "type": "number"
    },
    "easing": {
      "description": "A named easing, or {customBezier {x1, y1, x2, y2}} or {customSpring {mass, stiffness, damping}}.",
      "oneOf": [
        {
          "enum": [
            "linear",
            "easeIn",
            "easeOut",
            "easeInOut",
            "easeInBack",
            "easeOutBack",
            "easeInOutBack",
            "gentle",
            "quick",
            "bouncy",
            "slow"
          ],
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ]
    },
    "id": {
      "description": "The layer the interaction is on (default the selection).",
      "type": "integer",
      "x-khp-types": [
        "Node"
      ]
    },
    "ids": {
      "description": "The layers it goes on, each its own interaction (instead of id; default the selection).",
      "items": {
        "type": "integer"
      },
      "type": "array",
      "x-khp-types": [
        "Node"
      ]
    },
    "transition": {
      "additionalProperties": true,
      "description": "{type: instant|dissolve|smartAnimate|moveIn|moveOut|push|slideIn|slideOut, direction?: left|right|top|bottom}.",
      "type": "object"
    },
    "trigger": {
      "additionalProperties": true,
      "description": "What starts it: {type: onClick|onHover|onPress|onDrag|mouseEnter|mouseLeave|mouseDown|mouseUp|afterDelay {ms}|keyPress {key}} (default onClick).",
      "type": "object"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/design-darwin-arm64@0.1.0 and the kit itself (design_commands through @kition/cli@0.1.1, built from KitionAI/kition-design@abc7e16).
