/mcp-apps-studio:widget-ux-patternsfrom mcp-apps-studio
Guides design of agent-rendered widgets: choosing display modes (inline card, carousel, fullscreen, PiP), action budgets, layout, theming, and accessibility.
Ships in mcp-apps-studio. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An agent widget is a guest in someone else's interface. It inherits their theme, competes with their composer, and gets closed the moment it feels like a different app. Design to the container.
Start with the smallest presentation that lets the user understand the result or finish the task. Request more space only when the workflow demands it.
A focused result, a confirmation, or a small set of actions. The default.
Mobile: the card may expand its height to match content, up to the height of the mobile display area.
Scanning a small set of similar, visually rich options — restaurants, playlists, events.
Rich tasks needing room: maps, editing canvases, detailed browsing.
An ongoing activity that should stay visible while the conversation continues — a live session, game, or video.
const modes = app.getHostContext()?.availableDisplayModes ?? ["inline"];
if (modes.includes("fullscreen") && app.requestDisplayMode) {
await app.requestDisplayMode({ mode: "fullscreen" });
}
The host may grant a different mode than requested. Render from the mode you were given, never the one you asked for.
hostContext.theme (and prefers-color-scheme as a backstop, since
onhostcontextchanged is not universally supported).safeAreaInsets from host context.sendSizeChanged / notifyIntrinsicHeight rather than
guessing a fixed height.aria-pressed, aria-live for async
results). A2UI: plumb AccessibilityAttributes to the native API.prefers-reduced-motion.Every widget needs four states, and three of them get skipped.
| State | Rule |
|---|---|
| Loading | Render a skeleton from ontoolinput before the result arrives. Never a bare spinner when you already know the shape. |
| Empty | Say what is missing and what to do next. Not "No results." |
| Error | Human-readable message plus a retry path. Also call updateModelContext so the model knows the view is degraded and can help. |
| Partial | With ontoolinputpartial, render progressively — but treat healed JSON as incomplete and never act on it. |
ui/message / sendFollowUpMessage when the user should say something
next; use ui/update-model-context when the model just needs to know
something. Confusing these produces either a spammy transcript or a model
that has no idea what the user selected.The host mirrors locale to document.documentElement.lang.
const locale = document.documentElement.lang || "en-US";
Format dates, numbers, and currency from that locale — not from the server's.
Do
Don't
host-capability-matrix — which modes and APIs the target host supports.ui-state-architecture — preserving presentation state across remounts.ui-performance — skeletons, partial input, and offscreen pausing.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
widget-design, ux-patterns, display-modes, agent-widget, accessibility, theming
npx claudepluginhub thelobbi/claude --plugin mcp-apps-studio16 skills in this plugin
/a2ui-protocolThis skill should be used when building A2UI (Agent to UI) interfaces — the six streamed message types, surfaces, the flat adjacency-list component model, component catalogs, JSON Pointer data binding and two-way input binding, actions vs functionCalls, CheckRule validation, and progressive streaming./ag-ui-protocolThis skill should be used when integrating AG-UI — the full event taxonomy (lifecycle, text message, tool call, state, activity, reasoning, custom), RunAgentInput, SSE and binary transports, AbstractAgent/HttpAgent, STATE_DELTA JSON Patch, generative UI, human-in-the-loop interrupts, and CopilotKit frontends./host-capability-matrixThis skill should be used when deciding which MCP Apps or window.openai APIs are safe to depend on for a given host — the verified M365 Copilot support matrix for the component bridge, tool descriptor _meta, annotations, resource _meta, CSP properties, and client _meta, plus the feature-detection patterns that keep a widget portable./m365-copilot-packagingThis skill should be used when shipping an MCP app into Microsoft 365 Copilot as a declarative agent — prerequisites, the widget host CORS URL, OAuth 2.1 and Entra SSO redirect URIs, Agents Toolkit sideloading, dynamic tool discovery, and the Copilot-specific capability gaps to design around./mcp-apps-protocolThis skill should be used when implementing or debugging the MCP Apps extension — ui:// resource URIs, the text/html;profile=mcp-app mimeType, every _meta.ui field, the full ui/* JSON-RPC bridge over postMessage, tool visibility, host context, display modes, and the five lifecycle phases./mcp-apps-sdkThis skill should be used when writing code against @modelcontextprotocol/ext-apps — registerAppTool, registerAppResource, RESOURCE_MIME_TYPE, the App class and its handlers, the React useApp hook, the app-bridge entry point, and the Vite single-file build that MCP Apps expect.Other plugins' skills for the same job