logoAnt Design X

DesignDevelopmentComponentsX MarkdownX SDKPlayground
  • Introduction
  • Code Examples
  • Streaming Rendering
  • Themes
  • Plugins
    • Overview
    • Latex
    • HighlightCode
    • Mermaid
    • CustomPlugins
    • Theme & Locale
  • Components
    • Overview
    • Think
    • DataChart
    • Custom Component

Streaming Rendering

Introduction

Optimize streaming Markdown rendering in LLM scenarios by caching to hide markdown formatting and animation effects.

Code Demos

Configuration

streaming

ParameterDescriptionTypeDefault
hasNextChunkWhether there is more streaming databooleanfalse
enableAnimationEnable text fade-in animationbooleanfalse
animationConfigText animation configurationAnimationConfig{ fadeDuration: 200, opacity: 0.2 }

AnimationConfig

PropertyDescriptionTypeDefault
fadeDurationFade animation duration in millisecondsnumber200
opacityOpacity value for fading characters (0-1)number0.2

Usage Example

tsx
import { XMarkdown } from '@ant-design/x-markdown';
const App = () => {
return (
<XMarkdown
content="# Hello World\n\nThis is a streaming rendering example."
streaming={{
hasNextChunk: true,
enableAnimation: true,
animationConfig: {
fadeDuration: 300,
opacity: 0.3,
},
}}
/>
);
};
Caching

Hide Markdown formatting through caching

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Animation Effects
CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code