Skip to content

Commit a041e25

Browse files
committed
docs: fix inaccuracies and trim redundant prose across 12 pages
Accuracy fixes: - approval-card: remove false "loading state" a11y claim, fix icon format description to match PascalCase example - preferences-panel: remove false hard limits (2 sections, 5 items) that don't exist in schema, fix toggle "2-4" to "2+" - terminal: fix "auto-collapsed" claim (requires maxCollapsedLines) - message-draft: clarify cancelled outcome hides component - chart: replace broken Step 3 with actual registration example Simplification (-122 lines): - overview: remove "What is tool calling?" section and redundant numbered list under "How it works" - quick-start: remove "What you'll build", "Wire it up" intro, "Other frameworks", "Runtime options" sections - terminal: remove ANSI codes reference and exit code meanings - weather-widget: replace marketing copy with one-line description - item-carousel: remove "Design Details" implementation notes - geo-map: replace 31-line CSS token list with file reference - plan: remove framework-agnostic disclaimer - design-guidelines: remove redundant "Receipts" section
1 parent 229d74f commit a041e25

12 files changed

Lines changed: 29 additions & 151 deletions

File tree

apps/www/app/docs/approval-card/content.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Set `variant="destructive"` for dangerous or irreversible actions. The icon back
142142
},
143143
icon: {
144144
description:
145-
'Lucide icon name in kebab-case (e.g., "rocket", "trash-2", "alert-triangle")',
145+
'Lucide icon name (e.g., "Rocket", "trash-2"). Accepts PascalCase or kebab-case.',
146146
type: "string",
147147
},
148148
metadata: {
@@ -205,7 +205,6 @@ Long metadata values are automatically truncated with an ellipsis. Keep values c
205205
- `Tab` to move between buttons
206206
- `Enter` or `Space` to activate focused button
207207
- `Escape` triggers the cancel action
208-
- Loading state disables both buttons to prevent double-submission
209208
- Receipt state uses `role="status"` for screen reader announcements
210209
- Fade-in animation respects `prefers-reduced-motion`
211210

apps/www/app/docs/chart/content.mdx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,22 @@ import { Chart } from "@/components/tool-ui/chart";
6060
Register this renderer so tool results display as `Chart`.
6161

6262
```tsx
63-
<Chart
64-
id="clickable"
65-
type="line"
66-
data={data}
67-
xKey="time"
68-
series={[{ key: "value", label: "Value" }]}
69-
onDataPointClick={(point) => {
70-
console.log("Clicked:", point.xValue, point.yValue);
71-
}}
72-
/>
63+
import { type Toolkit } from "@assistant-ui/react";
64+
import { Chart } from "@/components/tool-ui/chart";
65+
import { safeParseSerializableChart } from "@/components/tool-ui/chart/schema";
66+
67+
export const toolkit: Toolkit = {
68+
showChart: {
69+
type: "backend",
70+
render: ({ result }) => {
71+
const parsed = safeParseSerializableChart(result);
72+
if (!parsed) {
73+
return null;
74+
}
75+
return <Chart {...parsed} />;
76+
},
77+
},
78+
};
7379
```
7480

7581
</Step>

apps/www/app/docs/design-guidelines/content.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ If the assistant can't point at something later, you lose half the value of rend
160160

161161
Use stable IDs from your backend — database IDs, canonical URLs — not array indexes or render-time UUIDs. Anything the user can act on should have an ID the assistant can cite.
162162

163-
## Receipts
164-
165-
When a user takes an action with consequences, the tool UI should transition to a receipt — a read-only confirmation of what happened. This gives the user proof and the assistant something to cite later.
166-
167-
See the [Receipts](/docs/receipts) page for patterns and copy guidance.
168-
169163
## Anti-Patterns
170164

171165
- **Input fields:** Input fields compete with the main chat composer. Ask whether the assistant could gather that information through conversation, or link to a form outside the chat.

apps/www/app/docs/geo-map/content.mdx

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -151,39 +151,7 @@ Theme behavior:
151151
/>
152152
```
153153

154-
Supported token keys:
155-
156-
- `--geo-map-canvas-bg`
157-
- `--geo-map-tooltip-bg`
158-
- `--geo-map-tooltip-fg`
159-
- `--geo-map-tooltip-shadow`
160-
- `--geo-map-tooltip-radius`
161-
- `--geo-map-tooltip-padding`
162-
- `--geo-map-tooltip-font-size`
163-
- `--geo-map-tooltip-font-weight`
164-
- `--geo-map-tooltip-line-height`
165-
- `--geo-map-popup-margin-bottom`
166-
- `--geo-map-popup-border`
167-
- `--geo-map-popup-radius`
168-
- `--geo-map-popup-bg`
169-
- `--geo-map-popup-fg`
170-
- `--geo-map-popup-shadow`
171-
- `--geo-map-popup-blur`
172-
- `--geo-map-popup-content-padding`
173-
- `--geo-map-popup-max-width`
174-
- `--geo-map-popup-font-family`
175-
- `--geo-map-zoom-bg`
176-
- `--geo-map-zoom-fg`
177-
- `--geo-map-zoom-border`
178-
- `--geo-map-zoom-hover-bg`
179-
- `--geo-map-zoom-hover-fg`
180-
- `--geo-map-zoom-disabled-bg`
181-
- `--geo-map-zoom-disabled-fg`
182-
- `--geo-map-zoom-shadow`
183-
- `--geo-map-zoom-focus-ring`
184-
- `--geo-map-zoom-radius`
185-
- `--geo-map-zoom-size`
186-
- `--geo-map-zoom-font-size`
154+
See `geo-map-theme.module.css` for all available token keys.
187155

188156
## Props
189157

apps/www/app/docs/item-carousel/content.mdx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,6 @@ export const toolkit: Toolkit = {
129129
</Feature>
130130
</FeatureGrid>
131131

132-
## Design Details
133-
134-
How the carousel handles common interaction patterns:
135-
136-
**Responsive button layout:** Each card is a container (`@container/card`). Narrow cards stack buttons vertically with the primary on top. Above 176px, buttons flow horizontally with the primary on the right. `flex-col-reverse` keeps DOM order consistent while adapting visual hierarchy.
137-
138-
**Equal card heights:** Cards use CSS Grid (`grid-flow-col` with `auto-cols-max`). Grid cells match heights automatically, so a two-line title aligns with one-line neighbors.
139-
140-
**Smooth scroll animation:** Custom JavaScript scrolling with a cubic-bezier ease-out curve. Respects `prefers-reduced-motion` with an instant-scroll fallback. Snap positions are calculated dynamically from card offsets.
141-
142-
**Image handling:** Accepts image URLs or hex color fallbacks. Images use `loading="lazy"` and `decoding="async"`. On hover, images scale up 5% with a `duration-200` transform transition.
143-
144-
**Overlay click target:** Interactive cards render a full-card overlay button (`absolute inset-0`, `z-10`) for `onItemClick`, while action buttons sit above it (`z-20`) so primary actions stay independently clickable.
145-
146-
**Touch optimization:** `touch-manipulation` eliminates the 300ms tap delay on iOS. Navigation buttons appear only on hover/focus (desktop) with backdrop blur.
147-
148132
## Props
149133

150134
<TypeTable

apps/www/app/docs/message-draft/content.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Configure the countdown length with `undoGracePeriod` (in milliseconds).
145145

146146
## Receipt States
147147

148-
Pass `outcome` to render a one-line receipt. Useful for showing the final state in conversation history.
148+
Pass `outcome="sent"` to render a one-line confirmation receipt. `outcome="cancelled"` hides the component entirely.
149149

150150
## Props
151151

apps/www/app/docs/overview/content.mdx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,7 @@ Tool UI is a component library built for this. Each component turns a specific k
5050
</MockThread>
5151
</div>
5252

53-
Same data, different experience. The left side either dumps JSON to the user or, with a markdown renderer like MDX, gives you a plain text link. The right side renders a clickable card that looks and behaves like a native part of the conversation.
54-
55-
## What is tool calling?
56-
57-
Tool calling happens when the assistant _does_ something instead of _saying_ something. The user asks "find me flights to Tokyo," and instead of describing options in a paragraph, the assistant calls a search tool and returns structured results.
58-
59-
You define the functions the model can invoke: searching a database, fetching a URL, running a calculation. The model decides when to call them based on the conversation. It sends structured arguments, your server executes the function, and a result comes back.
60-
61-
Usually that result is plain text or JSON dumped into the chat. Tool UI handles what comes after: **rendering those results as real UI**.
53+
Same data, different experience.
6254

6355
## What if tool results could render UI?
6456

@@ -121,16 +113,8 @@ flowchart LR
121113
122114
`} />
123115

124-
1. **The assistant calls a tool.** Based on the conversation, the model invokes a tool you've defined (e.g., `previewLink`, `searchFlights`).
125-
2. **The tool returns JSON.** Your server-side function executes and returns structured data matching an `outputSchema`.
126-
3. **The schema matches. A component renders.** On the client, a registered renderer parses the JSON against the component's schema. If it matches, the component renders inline in the chat message.
127-
4. **The user interacts.** For display components, this is the end. For interactive components (decisions, approvals), the user takes an action.
128-
5. **The result returns.** The user's choice is sent back to the assistant as a tool result via `addResult`, continuing the conversation.
129-
130116
### Minimal example
131117

132-
The server defines a tool with a typed output schema. The client registers a renderer that maps that output to a component.
133-
134118
**Server:** define a tool that returns structured data.
135119

136120
```ts title="app/api/chat/route.ts"

apps/www/app/docs/plan/content.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ export const toolkit: Toolkit = {
106106

107107
</Steps>
108108

109-
These snippets use [assistant-ui](https://assistant-ui.com) for end-to-end wiring, but the Plan component itself is framework-agnostic at the UI layer: you can use it in any React codebase with any LLM SDK or tool-calling interface that can provide compatible props.
110-
111109
## Key Features
112110

113111
<FeatureGrid>

apps/www/app/docs/preferences-panel/content.mdx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ import { PreferencesPanel } from "@/components/tool-ui/preferences-panel";
181181
type: "string",
182182
},
183183
sections: {
184-
description:
185-
"Preference sections with controls (max 2 sections, max 5 total items)",
184+
description: "Preference sections with controls",
186185
type: "PreferenceSection[]",
187186
required: true,
188187
},
@@ -262,8 +261,7 @@ Use the receipt variant to display confirmed preferences or validation errors.
262261
type: "string",
263262
},
264263
items: {
265-
description:
266-
"Preference controls in this section. Each section supports 1-3 items.",
264+
description: "Preference controls in this section",
267265
type: "PreferenceItem[]",
268266
required: true,
269267
},
@@ -290,7 +288,7 @@ Use the receipt variant to display confirmed preferences or validation errors.
290288
},
291289
type: {
292290
description:
293-
"Control type: switch (binary), toggle (2-4 options), select (5+ options)",
291+
"Control type: switch (binary), toggle (2+ options), select (5+ options)",
294292
type: '"switch" | "toggle" | "select"',
295293
required: true,
296294
},
@@ -333,13 +331,10 @@ Use the receipt variant to display confirmed preferences or validation errors.
333331
}}
334332
/>
335333

336-
## Limits
334+
## Control Type Guide
337335

338-
- **Sections**: 2 maximum per panel
339-
- **Items per section**: 3 maximum
340-
- **Total items**: 5 maximum across all sections
341-
- **Toggle options**: 2-4 choices (use select for more)
342-
- **Select options**: 5+ choices (use toggle for fewer)
336+
- **Toggle options**: minimum 2 choices (use select for 5+)
337+
- **Select options**: minimum 5 choices (use toggle for fewer)
343338

344339
## Accessibility
345340

apps/www/app/docs/quick-start/content.mdx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import { Bot } from "lucide-react";
1919
</AlertDescription>
2020
</Alert>
2121

22-
Add a Tool UI component to a chat app. By the end you'll have an assistant that renders a rich link preview card instead of raw JSON.
23-
24-
**What you'll build:** A backend tool that fetches link metadata, and a frontend renderer that turns the JSON response into an interactive LinkPreview card, all wired together through [assistant-ui](https://www.assistant-ui.com/).
22+
Add a Tool UI component to a chat app powered by [assistant-ui](https://www.assistant-ui.com/).
2523

2624
## Install
2725

@@ -69,8 +67,6 @@ This copies the source files into your project. The code is yours - change it ho
6967

7068
## Wire it up
7169

72-
Two pieces connect the component to the conversation: a **backend tool** that returns structured data when the model calls it, and a **frontend renderer** that turns that data into the LinkPreview component.
73-
7470
<Steps>
7571

7672
<Step title="Define a backend tool">
@@ -204,16 +200,6 @@ Components like [Option List](/docs/option-list) and [Approval Card](/docs/appro
204200

205201
For the full implementation pattern, including how to forward frontend tools through your API route and enable auto-continue after user decisions, see the [Advanced](/docs/advanced) page.
206202

207-
## Other frameworks
208-
209-
Tool UI components work with any React app. Without assistant-ui, you manually parse tool outputs and render components. Use assistant-ui for the best experience.
210-
211-
Tool UI components are installed from registry entries, and each entry includes `components/tool-ui/shared` automatically.
212-
213-
## Runtime options
214-
215-
[assistant-ui](https://www.assistant-ui.com/) supports multiple runtimes: [AI SDK](https://ai-sdk.dev/), [LangGraph](https://langchain-ai.github.io/langgraphjs/), LangServe, [Mastra](https://mastra.dev/), or custom backends. The examples above use AI SDK v6.
216-
217203
## Next steps
218204

219205
- [**Gallery**](/docs/gallery): Browse all available components

0 commit comments

Comments
 (0)