---
title: Widgets
summary: What a SpaceMIX widget is, who builds one and where, what a widget can and cannot do, where to start as a person or an agent, and the pages of the Widgets area.
audience: both
stability: experimental
since: protocol 1
---

# Widgets

A widget is a small live view of the team's data: one HTML fragment plus the read-only tool calls ("sources") that feed it, and, for public data no extension has, fixed web URLs the server fetches (web sources). The assistant writes most of them from a description; you can also write one by hand. A widget belongs to the team, not to any extension: everyone on the server sees and can change every widget. It shows on Dashboards, in the **Widgets** gallery and inside Team Chat messages, each time in a sandboxed frame of its own.

Use a widget for an at-a-glance view of data that installed extensions already have, or of public data from a web API: a count, a short list, a chart, a price. If you need a place to work in, with data of its own, buttons that change things or a network connection, build an [extension](../extensions/index.md) instead.

The exact surface (the frame, `spacemix`, `spacemix.ui`, the `op-*` classes, the `--op-*` variables, tokens, the grid) is in the [widget contract](../reference/widgets.md#the-widget-contract). These pages are the guide to it.

## Who builds them

- **Anyone with `server:widgets`, in the Studio**, in a widget session of the [Studio](../guide/studio.md). Describe the widget in the Studio's chat; the assistant builds it beside a live preview and you save it. See [Building a widget](building.md).
- **The assistant in any chat**, with the `widget_create` and `widget_update` tools of its `core.widgets` tool group, which a chat loads when someone asks for a widget, a dashboard tile or a chart (see [How the assistant gets its tools](../agents.md#how-the-assistant-gets-its-tools)), when the person asking holds `server:widgets`.
- **By hand**, as a widget file (`.widget.json`) imported in the **Widgets** gallery, which takes `server:widgets` too. See [Writing one by hand](building.md#writing-one-by-hand).
- **An agent**: the Studio's assistant, or a coding agent in a checkout that writes a widget file. See [Building widgets as an agent](for-agents.md).

## What a widget can and cannot do

| A widget can | A widget cannot |
|---|---|
| Read what its sources return, as `spacemix.data`, and render again on every update through `spacemix.onData`. | Reach the network. The frame's CSP is `default-src 'none'`: no `fetch`, no external scripts, stylesheets, fonts or images. Public web data comes only through a web source, whose fixed URL the server fetches; see [Web sources](data.md#web-sources). WebRTC isn't covered by the CSP, and navigating can leak data from inside an extension's frame; see [Known gaps](../reference/widgets.md#known-gaps). |
| Run another read-only tool on demand with `spacemix.call(tool, args)`. | Change data outside its own store. Sources and `spacemix.call` take only read-only tools of installed extensions: collection `list` and `get`, actions declared `readOnly: true`, MCP tools annotated `readOnlyHint: true`. Never the core's own `widget_*` tools. A web source only reads (`GET`, nothing of the viewer sent), and `spacemix.call` can't use one. |
| Save data of its own (ticks, notes, choices, its settings' values) in its [store](data.md#saving-data) with `spacemix.save`, read back as `spacemix.store` by everyone who sees it (widget frame 2). | Keep anything else. The store is one JSON object of at most 256 KB, shared by its viewers; the widget can't make tables. |
| Open an extension with `spacemix.open(extensionId)` or `data-open="<extension id>"` on an element. | Reach the app. It has no `host`, no `@spacemix/sdk` and no browser storage: the frame's origin is opaque. |
| Use the widget kit (`spacemix.ui` and the `op-*` classes) and follow the light or dark theme through the `--op-*` variables. | Navigate. Links and forms do nothing, and a widget that sends its frame elsewhere is stopped with `The widget navigated away from its frame, so it was stopped.` Inside an extension's frame that stop comes after the fact; see [Known gaps](../reference/widgets.md#known-gaps). |
| Use inline `<style>` and `<script>`, and `data:` or `blob:` images, `data:` fonts. | Use a tool whose extension isn't installed for the viewer. It shows an "Extension uninstalled" pill in its place. |

A widget runs as whoever is looking at it. Its sources and its `spacemix.call`s run with that person's access, without asking for approval, so two people can see different data in the same widget. See [Runs as the viewer](data.md#runs-as-the-viewer).

## Where to start

**If you are a person:** open **Widgets** from the server menu at the top left (under **Current server**), or with Ctrl/⌘+K, and choose **Create widget**, then read [Building a widget](building.md). [Look and feel](ui.md) has the kit's recipes; the [Widget checklist](checklist.md) is what to check before you share one.

**If you are an AI agent:** read [Building widgets as an agent](for-agents.md). It has the loop, the `widget_*` and `dashboard_*` tools, the rules the host rejects, and where the exact reference is (`llms-full.txt` has every page in one file).

**If you build an extension that shows widgets** (as Dashboards and Team Chat do): the API is `host.widgets`, with the `widgets` or `widgets:view` permission, in [Widget reference](../reference/widgets.md#hostwidgets) and [Widgets API](../reference/host/widgets.md). The React helpers are `useWidgetList`, `useWidgetFeed` and `WidgetFrame` in [React hooks](../reference/react.md#usewidgetlist).

## The pages

| Page | What it covers |
|---|---|
| [Building a widget](building.md) | A widget session in the Studio step by step, saving and versions, settings and the settings panel, writing a widget file by hand, import and export, the limits. |
| [Data: sources, spacemix.call and the store](data.md) | Sources, how data arrives, the per-viewer cache and `refreshSeconds`, `spacemix.call`, saving data in the store, errors, running as the viewer. |
| [Look and feel](ui.md) | The `spacemix.ui` helpers and `op-*` classes with recipes, the theme variables, the grid and sizing, phones, reduced motion. |
| [Dashboards and Team Chat](placing.md) | Putting a widget on a dashboard and arranging it, the corner menus, placing a widget in a Team Chat message, who sees what. |
| [Widget checklist](checklist.md) | What to check before saving or sharing a widget. |
| [Building widgets as an agent](for-agents.md) | The short version for agents, with the parts agents get wrong. |
| [Widget reference](../reference/widgets.md) | The widget contract: the frame, `spacemix`, the kit, messages, the data cache, tokens, the grid constants, `host.widgets`, the layout helpers. |

## Stability

**Stability:** experimental, as the area. The widget frame itself (the document and its CSP, `spacemix`, `spacemix.ui`, the `op-*` classes, the `--op-*` variables, the messages), the grid constants and the widget token format are stable and versioned by `WIDGET_FRAME_VERSION` (today `3`; version 2 added the store, version 3 is the SpaceMIX rename), not by `PROTOCOL_VERSION`; see [The widget contract](../reference/widgets.md#the-widget-contract). The Studio, the gallery, Dashboards and the assistant's tools described in this area are app behaviour and may change.

Sources: `apps/desktop/src/lib/widgets.ts` (storage, drafts, versions), `apps/desktop/src/lib/widgetRuntime.ts` (sources and the data cache), `apps/desktop/src/lib/widgetTools.ts` (the assistant's tools), `apps/desktop/src/lib/widgetStore.ts` and `apps/desktop/src-tauri/src/widget_store.rs` (the store), `apps/desktop/src-tauri/src/widget_frame.html` (the frame and the kit).
