Major Chords
FollowUpSuggestions
Dynamic suggestion chips that appear after assistant messages.
Overview
FollowUpSuggestions renders contextual suggestion buttons based on the runtime's thread.suggestions state. Unlike SuggestionChips which shows static welcome-screen suggestions, this component displays dynamic follow-up prompts generated by the runtime after each assistant response.
Demo
When to use
- Show dynamic follow-up questions after assistant responses
- Help users discover related topics or actions
- Auto-hide during streaming and when no suggestions exist
- Commonly placed after the last assistant message or at the bottom of the viewport
Features
- Dynamic suggestions: Reads from
thread.suggestionsstate provided by the runtime - Auto-hide: Hidden when thread is running or when no suggestions exist
- Auto-send: Clicks send the suggestion immediately by default
- Customizable: Override chip styling or provide a custom renderer
Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Container class |
chipClassName | string | - | Suggestion chip class |
autoSend | boolean | true | Send message immediately on click |
renderChip | function | - | Custom chip renderer |
Basic Usage
import { FollowUpSuggestions } from "@assistant-ui/chords";
export function MyThread() {
return (
<ThreadPrimitive.Root>
<ThreadPrimitive.Viewport>
<ThreadPrimitive.Messages components={{ ... }} />
<FollowUpSuggestions />
</ThreadPrimitive.Viewport>
</ThreadPrimitive.Root>
);
}Providing Suggestions via Runtime
Follow-up suggestions are provided by a SuggestionAdapter on the runtime:
const runtime = useLocalRuntime(MyModelAdapter, {
adapters: {
suggestion: {
async *generate({ messages }) {
const suggestions = await fetchSuggestions(messages);
yield suggestions.map((text) => ({ prompt: text }));
},
},
},
});Custom Chip Renderer
<FollowUpSuggestions
renderChip={(prompt, index) => (
<button key={index} className="my-custom-chip">
{prompt}
</button>
)}
/>Custom Styling
<FollowUpSuggestions
className="flex flex-wrap gap-3 justify-center"
chipClassName="rounded-lg bg-blue-500/20 px-4 py-2 text-sm hover:bg-blue-500/30"
/>SuggestionChips vs FollowUpSuggestions
| SuggestionChips | FollowUpSuggestions | |
|---|---|---|
| Data source | Static array you provide | Dynamic from runtime |
| When shown | Welcome screen (empty thread) | After assistant responses |
| Placement | Inside ThreadPrimitive.Empty | After messages in viewport |
Migration Notes
TODO: migrate to store — useThread → useAuiState(({ thread }) => thread)