v0 Platform API/Packages
@v0-sdk/react
Headless React components for rendering v0 Platform API content
Headless React components for rendering content from the v0 Platform API. Provides components for streaming messages, code blocks, thinking sections, and more.
Installation
Quick Start
Components
StreamingMessage
Renders streaming chat messages with real-time updates.
Props
message
- The streaming message datatheme?
- Visual theme (elegant
,minimal
,neobrutalism
,terminal
)className?
- Additional CSS classesonComplete?
- Callback when streaming completesonError?
- Callback for error handling
CodeBlock
Syntax-highlighted code blocks with copy functionality.
Props
code
- The code string to displaylanguage
- Programming language for syntax highlightingshowLineNumbers?
- Display line numberscopyable?
- Show copy buttontheme?
- Color theme for syntax highlighting
ThinkingSection
Displays AI thinking process with animated indicators.
Props
thoughts
- Array of thinking stepsisVisible?
- Control visibilityanimated?
- Enable animationscollapsible?
- Allow collapse/expand
TaskSection
Renders task lists and progress indicators.
Props
tasks
- Array of task objectsshowProgress?
- Display progress barinteractive?
- Allow user interactiononTaskComplete?
- Callback for task completion
Themes
Built-in Themes
Custom Themes
Hooks
useStreamingChat
Hook for managing streaming chat state.
useCodeHighlight
Hook for syntax highlighting with custom themes.
Styling
CSS Custom Properties
Tailwind CSS Classes
The components work seamlessly with Tailwind CSS:
TypeScript Support
Full TypeScript support with comprehensive type definitions:
Requirements
- React 18+ or React 19+
- TypeScript 5.0+ (for TypeScript projects)