Privacy-friendly analytics only with consent. No ads, no cross-site tracking. Read the privacy policy.
A walkthrough of the production chat surface: message state, token streaming, markdown that survives partial tokens, an input with stop-generation, and feedback actions. Slipstream components are stateless — you own the transport, they render.
pnpm add @slipstream-ui/core @slipstream-ui/ai# or copy source filesnpx shadcn@latest add https://slipstreamui.com/registry/conversation.json
The entire surface is driven by messages and an optional streamingMessageId. No context providers, no runtime lock-in — works with Vercel AI SDK, LangGraph, WebSockets, or a raw fetch stream.
const [messages, setMessages] = useState<MessageData[]>([]);const [streamingId, setStreamingId] = useState<string | null>(null);
Append the assistant message, set it as streaming, and update its content on every chunk. Response repairs half-finished markdown mid-stream, so a chunk ending in **half renders cleanly instead of showing raw asterisks.
const abortRef = useRef<AbortController | null>(null);async function send(text: string) {const replyId = crypto.randomUUID();setMessages((prev) => [...prev,{ id: crypto.randomUUID(), role: 'user', content: text },{ id: replyId, role: 'assistant', content: '' },]);setStreamingId(replyId);const controller = new AbortController(); // keep in a ref for StopabortRef.current = controller;const res = await fetch('/api/chat', {method: 'POST',body: JSON.stringify({ prompt: text }),signal: controller.signal,});if (!res.ok || !res.body) {setStreamingId(null);return;}const reader = res.body.getReader();const decoder = new TextDecoder();let content = '';for (;;) {const { done, value } = await reader.read();if (done) break;content += decoder.decode(value, { stream: true });setMessages((prev) =>prev.map((m) => (m.id === replyId ? { ...m, content } : m)));}setStreamingId(null);}
<Conversationmessages={messages}streamingMessageId={streamingId ?? undefined}renderContent={(content) => <Response parseIncompleteMarkdown>{content}</Response>}welcomeTitle="Ask anything"welcomeSuggestions={['Summarize this thread', 'Draft a reply']}onWelcomeSelect={send}/><PromptInputonSubmit={send}isLoading={streamingId !== null}onStop={() => abortRef.current?.abort()}/>
aria-busy and announces completion politely.prefers-reduced-motion.