logoAnt Design X

DesignDevelopmentComponentsX MarkdownX SDKX SkillPlayground
  • Introduction
  • Code Examples
    2.0.0
  • Playground
  • Themes
  • Streaming
  • Components
    • Overview
    • Chat Enhancement
    • Data Display
    • Rich Text Enhancement
  • Plugins
    • Overview
    • Latex
    • CustomPlugins

Streaming

Handle LLM streamed Markdown output: incomplete syntax recovery, progressive animation, and optional performance monitoring during development.

Code Examples

API

streaming

ParameterDescriptionTypeDefault
hasNextChunkWhether more chunks are comingbooleanfalse
incompleteMarkdownComponentMapComponent mapping for incomplete syntaxPartial<Record<Exclude<StreamCacheTokenType, 'text'>, string>>{}
enableAnimationEnable fade-in animationbooleanfalse
animationConfigAnimation configAnimationConfig{ fadeDuration: 200, easing: 'ease-in-out' }

AnimationConfig

PropertyDescriptionTypeDefault
fadeDurationDuration in msnumber200
easingCSS easing functionstring'ease-in-out'

debug

PropertyDescriptionTypeDefault
debugWhether to enable performance monitor panelbooleanfalse

⚠️ debug is for development only. Disable in production to avoid overhead and information leakage.

Supported Incomplete Types

TokenTypeExample
link[text](https://example
image![alt](https://img...
heading###
table| col1 | col2 |
xml<div class="

Minimal Setup

tsx
<XMarkdown
content={content}
streaming={{
hasNextChunk,
enableAnimation: true,
incompleteMarkdownComponentMap: {
link: 'link-loading',
table: 'table-loading',
},
}}
components={{
'link-loading': LinkSkeleton,
'table-loading': TableSkeleton,
}}
/>

FAQ

Can hasNextChunk always be true?

No. Set it to false for the last chunk so placeholders can be flushed into final rendered content.

Syntax Processing

Incomplete syntax recovery and placeholders

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Animation & Debug

Fade-in animation and optional debug panel

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Markdown Source
Rendered Output
Animation
Debug panel