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 data
- theme?- Visual theme (- elegant,- minimal,- neobrutalism,- terminal)
- className?- Additional CSS classes
- onComplete?- Callback when streaming completes
- onError?- Callback for error handling
CodeBlock
Syntax-highlighted code blocks with copy functionality.
Props
- code- The code string to display
- language- Programming language for syntax highlighting
- showLineNumbers?- Display line numbers
- copyable?- Show copy button
- theme?- Color theme for syntax highlighting
ThinkingSection
Displays AI thinking process with animated indicators.
Props
- thoughts- Array of thinking steps
- isVisible?- Control visibility
- animated?- Enable animations
- collapsible?- Allow collapse/expand
TaskSection
Renders task lists and progress indicators.
Props
- tasks- Array of task objects
- showProgress?- Display progress bar
- interactive?- Allow user interaction
- onTaskComplete?- 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)