What is the LiveCodes SDK?
The LiveCodes SDK is a JavaScript library that allows you to:- Embed playgrounds in your web applications
- Control playground behavior programmatically
- Listen to playground events (code changes, console output, test results)
- Load and modify configurations dynamically
- Run code and get results
- Execute custom commands for advanced use cases
Key Features
Multiple Integration Options
- Vanilla JS/TS: Use the core SDK with any framework or vanilla JavaScript
- React Component: First-class React component support
- Vue Component: Native Vue 3 component
- Svelte: Can be used in Svelte applications
Flexible Embedding Modes
- Standard Mode: Full-featured playground with editor and result
- Headless Mode: Run code without visible UI
- Lazy Loading: Load playgrounds only when needed
- Click-to-Load: Show a placeholder until user interaction
Rich API
The SDK provides comprehensive methods to:- Get and set configurations
- Run and format code
- Watch for changes and events
- Control the UI (show/hide panels, tools)
- Run tests and get results
- Generate share URLs
SDK Exports
The SDK exports the following from the main package:Framework Components
Quick Example
Use Cases
- Interactive Documentation: Embed runnable code examples
- Educational Platforms: Create interactive coding tutorials
- Code Sharing: Build platforms for sharing and showcasing code
- Testing Environments: Run and test code in isolated environments
- Live Coding: Create collaborative coding experiences
Browser Support
The SDK works in all modern browsers that support ES modules and the following features:- ES2020+
- Dynamic imports
- PostMessage API
- IntersectionObserver (for lazy loading)
Next Steps
Installation
Install the SDK via npm, yarn, or pnpm
Getting Started
Create your first embedded playground
API Reference
Explore the complete API documentation
React Component
Use the React component in your app