Dosu LogoDosu Logo
Ask
Join our Discord
assistant-ui's SpacePublic
assistant-ui
Documentsassistant-ui's Space
markdown
markdown
Type
External
Status
Published
Created
Mar 17, 2026
Updated
Aug 25, 2026
Updated by
Dosu Bot
Source
apps/docs/content/docs/ui/markdown.mdx

import { MarkdownSample } from "@/components/pages/docs/samples/markdown";
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
import { MarkdownCodeBlockSample } from "@/components/pages/docs/samples/markdown/code-block-and-copy";
import { MarkdownRichDocumentSample } from "@/components/pages/docs/samples/markdown/rich-document";
import { MarkdownStreamingSample } from "@/components/pages/docs/samples/markdown/streaming-markdown";
import { MarkdownGfmSample } from "@/components/pages/docs/samples/markdown/gfm-extras";

Markdown support is already included by default in the `Thread` component.

Enabling markdown support#

### Add `markdown-text`

<InstallCommand shadcn={["markdown-text"]} />

This adds a /components/assistant-ui/markdown-text.tsx file to your project, which you can adjust as needed.

Use it in your application#

Pass the MarkdownText component to the MessagePrimitive.Parts component

import { MarkdownText } from "@/components/assistant-ui/markdown-text";

const AssistantMessage: FC = () => {
  return (
    <MessagePrimitive.Root className="...">
      <div className="...">
        <MessagePrimitive.Parts>
          {({ part }) => part.type === "text" ? <MarkdownText /> : null}
        </MessagePrimitive.Parts>
      </div>
      <AssistantActionBar />

      <BranchPicker className="..." />
    </MessagePrimitive.Root>
  );
};

Examples#

Code Block and Copy#

Fenced code blocks get a language header and a copy button, and inline code keeps compact styling. The preview also uses syntax highlighting, which the copied component does not include by default.

Rich Document#

The renderer shows headings, emphasis, links, nested lists, a blockquote, a divider, and a table from one completed response.

Streaming Markdown#

Select Replay. The markdown increases in steps, and the text part shows a running status until the last chunk.

GitHub Flavored Markdown#

Task-list checkboxes, strikethrough text, a bare autolink, and an aligned table show through the built-in GFM support.

Syntax highlighting#

Syntax Highlighting is not included by default, see Syntax Highlighting to learn how to add it.

Related Components#

  • Syntax Highlighting - Add code highlighting to markdown
  • Mermaid - Render diagrams in markdown code blocks
Documents
AG-UI Message History Management
CHANGELOG
CHANGELOG
CHANGELOG
external-store
overview
README
AG-UI Streaming State Management
hooks
index
introduction
overview
part-1
README
README
stockbroker
AI SDK Integration
ai-sdk
assistant-runtime-provider
expo
hooks
index
index
index
introduction
migration
migration
overview
part-2
README
README
README
README
README
README
README
README
stockbroker
Cloud Message Pagination
index
Generative UI Date and Time Controls
In-Memory Thread Lifecycle
CHANGELOG
CHANGELOG
CHANGELOG
Local Runtime Message History
CHANGELOG
Markdown Preprocessing and Repair
CHANGELOG
CHANGELOG
MCP App Tool UI Rendering
CHANGELOG
CHANGELOG
message
MCP OAuth State Management
MessageRepository Branch Pointer Invariant
Next.js Cache Components
Remote Thread List Runtime
adapters
CHANGELOG
CHANGELOG
hooks
index
README
README
thread-runtime
Render Prop Leakage
Run Cancellation and Abort Signal Propagation
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
README
Run Telemetry Model ID Extraction
SSR-Safe Thread ID Generation
Stream Decoder Buffer Limits
CHANGELOG
CHANGELOG
StreamdownTextPrimitive
index
Streaming Markdown Rendering
CHANGELOG
CHANGELOG
index
introduction
part-1
AGENTS
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CHANGELOG
CODE_OF_CONDUCT
CONTRIBUTING
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README_LANGGRAPH
SECURITY
SPEC
SPEC_AssistantFrame
SPEC_ModelContextRegistry
action-bar
action-bar-more
adapters
artifacts
assistant-if
assistant-modal
assistant-modal
assistant-runtime
assistant-sidebar
attachment
attachment
attachment-runtime
branch-picker
chatgpt
claude
composer
composer-runtime
composition
context-display
custom-backend
custom-backend
error
file
form-demo
grok
heat-graph
hooks
image
index
index
index
index
index
index
index
index
index
markdown
mem0
mermaid
message-part
message-part-runtime
message-runtime
message-timing
modal
model-selector
part-3
perplexity
pick-a-runtime
primitives
primitives
quote
reasoning
selection-toolbar
sources
suggestion
syntax-highlighting
thread
thread
thread-list
thread-list
thread-list-item
thread-list-item-more
thread-list-item-runtime
thread-list-runtime
tool-fallback
tool-group
tw-shimmer
v4-legacy
v5-legacy