streamdown

Streaming-optimized React Markdown renderer with syntax highlighting, diagrams, math, and AI chat integration. Supports four optional plugins: code syntax highlighting via Shiki (200+ languages), Mermaid diagrams, LaTeX math rendering, and CJK text support Two rendering modes: streaming (with animated caret cursor for AI chat) and static (for blogs and documentation) Built-in security features including link safety modals, HTML tag filtering, URL sanitization, and configurable element...

npx skills add https://github.com/vercel/streamdown --skill streamdown

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

PropTypeDefaultPurpose
childrenstringMarkdown content
mode"streaming" | "static""streaming"Rendering mode
plugins{ code?, mermaid?, math?, cjk? }Feature plugins
isAnimatingbooleanfalseStreaming indicator
caret"block" | "circle"Cursor style
componentsComponentsCustom element overrides
controlsboolean | objecttrueInteractive buttons
linkSafetyLinkSafetyConfig{ enabled: true }Link confirmation modal
shikiTheme[light, dark]['github-light', 'github-dark']Code themes
classNamestringContainer class
allowedElementsstring[]allTag names to allow
disallowedElementsstring[][]Tag names to disallow
allowElementAllowElementCustom element filter
unwrapDisallowedbooleanfalseKeep children of disallowed elements
skipHtmlbooleanfalseIgnore raw HTML
urlTransformUrlTransformdefaultUrlTransformTransform/sanitize URLs

For full API reference, see references/api.md.

Plugin Quick Reference

PluginPackagePurpose
Code@streamdown/codeSyntax highlighting (Shiki, 200+ languages)
Mermaid@streamdown/mermaidDiagrams (flowcharts, sequence, etc.)
Math@streamdown/mathLaTeX via KaTeX (requires CSS import)
CJK@streamdown/cjkChinese/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:

Example Configurations

Copy and adapt from assets/examples/:

Common Gotchas

  1. Tailwind styles missing — Add @source directive or content entry for node_modules/streamdown/dist/*.js
  2. Math not rendering — Import katex/dist/katex.min.css
  3. Caret not showing — Both caret prop AND isAnimating={true} are required
  4. Copy buttons during streaming — Disabled automatically when isAnimating={true}
  5. Link safety modal appearing — Enabled by default; disable with linkSafety={{ enabled: false }}
  6. Shiki warning in Next.js — Install shiki explicitly, add to transpilePackages
  7. allowedTags not working — Only works with default rehype plugins
  8. Math uses $$ not $ — Single dollar is disabled by default to avoid currency conflicts

More skills from vercel

vercel-optimize
vercel
Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core...
officialdevelopmentdevops
writing-guidelines
vercel
Review docs/prose for Writing Guidelines compliance. Use when asked to "review my docs", "check writing style", "audit prose", "review docs voice and tone", or "check this page against the writing handbook".
officialdocumentcommunication
agent-friendly-apis
vercel
Companion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.
official
filesystem-agents
vercel
You are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.
official
add-provider-package
vercel
Guide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.
official
csv
vercel
Analyze and transform CSV data using bash tools
official
ai
vercel
Python `ai` module — models, agents, hooks, middleware, MCP, structured output
official
cron-jobs
vercel
Vercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.
official