# HTML UI

> The app's interface becomes an HTML page over the digital human. Every control is bound to a command, and an AI agent can redesign it live.

> [!PLANNED]
> The HTML UI is being built (status 20 November 2026): Windows and web first, Android and iOS next. This page describes the design that the apps will use.

## The idea

A full-screen, transparent HTML page lies over the 3D digital human. Only your buttons, sliders and panels are visible and clickable; everywhere else clicks reach the 3D scene. Each control calls an [MCP command](https://aimigo.live/docs/mcp.md). Because it is plain HTML, an AI agent can change it while it runs, and you keep several designs as versions.

## Binding controls to commands

No script is needed for the common cases:

```html
<div class="ui-panel" data-glass>
  <button data-mcp-tool="aimigo.audio.setMuted" data-mcp-input='{"muted":true}'>Mute</button>

  <input type="range" min="0" max="100"
         data-mcp-tool="aimigo.audio.setVolume" data-mcp-arg="volume" data-mcp-scale="0.01"
         data-mcp-get="aimigo.audio.getVolume" data-mcp-get-path="volume" data-mcp-refresh-on="settings">

  <input type="checkbox" data-mcp-tool="aimigo.ui.setFullscreen" data-mcp-arg="fullscreen">
</div>
```

| Attribute | Meaning |
|---|---|
| `data-mcp-tool` | command called on click (buttons) or on change (inputs) |
| `data-mcp-input` | fixed input as JSON |
| `data-mcp-arg`, `data-mcp-scale` | name of the input field that gets the control's value (range/number × scale, checkbox → true/false, others → text) |
| `data-mcp-tool-on`, `data-mcp-tool-off` | two commands for a toggle |
| `data-mcp-get`, `data-mcp-get-path`, `data-mcp-refresh-on` | read the current value into the control at start, after own calls and on these events |
| `data-mcp-state` | set by the runtime during a call: `busy`, `ok`, `error` (style it with CSS) |
| `data-glass` | the panel gets the glass background rendered by the app |

Scripts use `AimigoUI.call(command, input)` and `AimigoUI.on(eventName, fn)`.

## Rules

- The page background stays transparent; put controls into `.ui-panel` (or `[data-ui]`) containers. Everything outside stays click-through.
- Clicks run with the role **User**: bind only commands your end users may use ([permissions](https://aimigo.live/docs/permissions.md)).
- Designs are stored as versioned variants on the device; one is active. Commands: `aimigo.htmlui.setHtml`, `aimigo.htmlui.patch`, `aimigo.htmlui.variants.save`, `aimigo.htmlui.variants.activate` (role Customer).

The complete instructions for an AI designer are the skill `html-ui-design-binding` (`aimigo.skills.get { id: 'html-ui-design-binding' }`, see [skills](https://aimigo.live/docs/skills.md)).

> [!PLANNED]
> Delivery of your stored designs to your web pages and apps through your Aimigo account.
