streamdown
vercel/streamdown
Streaming-optimized React Markdown renderer with syntax highlighting, diagrams, math, and AI integration.
What is streamdown?
Streamdown is a drop-in replacement for react-markdown built for real-time AI streaming. It renders Markdown with syntax highlighting, Mermaid diagrams, LaTeX math, and CJK text support, and integrates seamlessly with Vercel AI SDK for chat applications.
- Render Markdown with streaming-aware incremental updates and animated carets
- Syntax-highlight code blocks in 200+ languages using Shiki
- Display Mermaid diagrams (flowcharts, sequence, state, etc.)
- Render LaTeX math expressions via KaTeX
- Support Chinese, Japanese, and Korean text rendering
- Provide interactive controls (copy, download) with link-safety confirmation modals
How to install streamdown
npx skills add https://github.com/vercel/streamdown --skill streamdown- React 16.8+ (hooks support)
- Tailwind CSS v3 or v4 configured in your project
- Node.js and npm/yarn for package installation
- Optional: Vercel AI SDK if integrating with AI streaming
How to use streamdown
- 1.Install the core package: npm install streamdown
- 2.Install optional plugins as needed (@streamdown/code, @streamdown/mermaid, @streamdown/math, @streamdown/cjk)
- 3.Configure Tailwind CSS by adding @source directives (v4) or content entries (v3) for streamdown and installed plugins
- 4.Import Streamdown and wrap your Markdown content: <Streamdown>{markdown}</Streamdown>
- 5.For AI streaming, pass isAnimating and caret props, and integrate with useChat() from Vercel AI SDK
- 6.Customize with plugins prop, security settings (linkSafety), and styling via className or CSS variables
Use cases
- Build AI chat interfaces with real-time message streaming and animated cursors
- Render technical documentation or blogs with code highlighting and diagrams
- Display AI-generated content with security controls and link verification
- Integrate with Vercel AI SDK for production chat applications
- Create static Markdown pages with full plugin support
- React developers building AI chat or streaming interfaces
- Full-stack engineers using Vercel AI SDK
- Documentation site maintainers
- Teams needing secure Markdown rendering with interactive controls
streamdown FAQ
No. Install only the plugins you need. The core streamdown package works standalone; plugins are optional and must be added to Tailwind config only if installed.
Use the useChat() hook, pass messages to Streamdown with the plugins prop, set isAnimating={true} on the last assistant message, and add caret='block' or caret='circle' for the animated cursor effect.
Streamdown requires Tailwind to scan its dist files. Add @source directives (v4) or content entries (v3) for streamdown and each installed plugin to your Tailwind config.
Pass linkSafety={{ enabled: false }} to the Streamdown component. For production, review references/security.md for hardening options.
Yes. Set mode='static' and Streamdown will render the entire Markdown at once without streaming animations, suitable for documentation and blogs.
Full instructions (SKILL.md)
Source of truth, from vercel/streamdown.
name: streamdown description: >- Implement, configure, and customize Streamdown — a streaming-optimized React Markdown renderer with syntax highlighting, Mermaid diagrams, math rendering, and CJK support. Use when working with Streamdown setup, configuration, plugins, styling, security, or integration with AI streaming (e.g., Vercel AI SDK). Triggers on: (1) Installing or setting up Streamdown, (2) Configuring plugins (code, mermaid, math, cjk), (3) Styling or theming Streamdown output, (4) Integrating with AI chat/streaming, (5) Configuring security, link safety, or custom HTML tags, (6) Using carets, static mode, or custom components, (7) Troubleshooting Tailwind, Shiki, or Vite issues.
Streamdown
Streaming-optimized React Markdown renderer. Drop-in replacement for react-markdown with built-in streaming support, security, and interactive controls.
Quick Setup
1. Install
npm install streamdown
Optional plugins (install only what's needed):
npm install @streamdown/code @streamdown/mermaid @streamdown/math @streamdown/cjk
2. Configure Tailwind CSS (Required)
This is the most commonly missed step. Streamdown uses Tailwind for styling and the dist files must be scanned.
Tailwind v4 — add to globals.css:
@source "../node_modules/streamdown/dist/*.js";
Add plugin @source lines only for packages you have installed (omitting uninstalled plugins avoids Tailwind errors). See plugin pages for exact paths:
- Code:
@source "../node_modules/@streamdown/code/dist/*.js"; - CJK:
@source "../node_modules/@streamdown/cjk/dist/*.js"; - Math:
@source "../node_modules/@streamdown/math/dist/*.js"; - Mermaid:
@source "../node_modules/@streamdown/mermaid/dist/*.js";
Tailwind v3 — add to tailwind.config.js:
module.exports = {
content: [
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./node_modules/streamdown/dist/*.js",
],
};
3. Basic Usage
import { Streamdown } from 'streamdown';
<Streamdown>{markdown}</Streamdown>
4. With AI Streaming (Vercel AI SDK)
'use client';
import { useChat } from '@ai-sdk/react';
import { Streamdown } from 'streamdown';
import { code } from '@streamdown/code';
export default function Chat() {
const { messages, input, handleInputChange, handleSubmit, isLoading } = useChat();
return (
<>
{messages.map((msg, i) => (
<Streamdown
key={msg.id}
plugins={{ code }}
caret="block"
isAnimating={isLoading && i === messages.length - 1 && msg.role === 'assistant'}
>
{msg.content}
</Streamdown>
))}
<form onSubmit={handleSubmit}>
<input value={input} onChange={handleInputChange} disabled={isLoading} />
</form>
</>
);
}
5. Static Mode (Blogs, Docs)
<Streamdown mode="static" plugins={{ code }}>
{content}
</Streamdown>
Key Props
| Prop | Type | Default | Purpose |
|---|---|---|---|
children | string | — | Markdown content |
mode | "streaming" | "static" | "streaming" | Rendering mode |
plugins | { code?, mermaid?, math?, cjk? } | — | Feature plugins |
isAnimating | boolean | false | Streaming indicator |
caret | "block" | "circle" | — | Cursor style |
components | Components | — | Custom element overrides |
controls | boolean | object | true | Interactive buttons; download: { filename } sets custom download names |
linkSafety | LinkSafetyConfig | { enabled: true } | Link confirmation modal |
shikiTheme | [light, dark] | ['github-light', 'github-dark'] | Code themes |
className | string | — | Container class |
allowedElements | string[] | all | Tag names to allow |
disallowedElements | string[] | [] | Tag names to disallow |
allowElement | AllowElement | — | Custom element filter |
unwrapDisallowed | boolean | false | Keep children of disallowed elements |
skipHtml | boolean | false | Ignore raw HTML |
urlTransform | UrlTransform | defaultUrlTransform | Transform/sanitize URLs |
For full API reference, see references/api.md.
Plugin Quick Reference
| Plugin | Package | Purpose |
|---|---|---|
| Code | @streamdown/code | Syntax highlighting (Shiki, 200+ languages) |
| Mermaid | @streamdown/mermaid | Diagrams (flowcharts, sequence, etc.) |
| Math | @streamdown/math | LaTeX via KaTeX (requires CSS import) |
| CJK | @streamdown/cjk | Chinese/Japanese/Korean text support |
Math requires CSS:
import 'katex/dist/katex.min.css';
For plugin configuration details, see references/plugins.md.
References
Use these for deeper implementation details:
- references/api.md — Complete props, types, and interfaces
- references/plugins.md — Plugin setup, configuration, and customization
- references/styling.md — CSS variables, data attributes, custom components, theme examples
- references/security.md — Hardening, link safety, custom HTML tags, production config
- references/features.md — Carets, remend, static mode, controls, GFM, memoization, troubleshooting
Example Configurations
Copy and adapt from assets/examples/:
- basic-streaming.tsx — Minimal AI chat with Vercel AI SDK
- with-caret.tsx — Streaming with block caret cursor
- full-featured.tsx — All plugins, carets, link safety, controls
- static-mode.tsx — Blog/docs rendering
- custom-security.tsx — Strict security for AI content
Common Gotchas
- Tailwind styles missing — Add
@sourcedirective orcontententry fornode_modules/streamdown/dist/*.js - Math not rendering — Import
katex/dist/katex.min.css - Caret not showing — Both
caretprop ANDisAnimating={true}are required - Copy buttons during streaming — Disabled automatically when
isAnimating={true} - Link safety modal appearing — Enabled by default; disable with
linkSafety={{ enabled: false }} - Shiki warning in Next.js — Install
shikiexplicitly, add totranspilePackages allowedTagsnot working — Only works with default rehype plugins- Math uses
$$not$— Single dollar is disabled by default to avoid currency conflicts
Related skills
More from vercel/streamdown and the wider catalog.

turborepo
Configure and troubleshoot Turborepo monorepo task pipelines, caching, and CI workflows.

access-protected-vercel-deployment
Access protected Vercel deployments using vercel curl or OIDC tokens without disabling protection.

ai-sdk
Vercel AI SDK expert guidance. Use when building AI-powered features — chat interfaces, text generation, structured output, tool calling, agents, MCP integration, streaming, embeddings, reranking, image generation, or working with any LLM provider.

build-agents
Default guidance for building AI agents with eve, Vercel's filesystem-first framework.

deployments-cicd
Vercel deployment and CI/CD expert guidance. Use when deploying, promoting, rolling back, inspecting deployments, building with --prebuilt, or configuring CI workflow files for Vercel.

vercel-cli
Vercel CLI expert guidance. Use when deploying, managing environment variables, linking projects, viewing logs, querying metrics, managing domains, or interacting with the Vercel platform from the command line.