with one click
livecodes-getting-started
// Quick start for standalone app at livecodes.io, embedding playgrounds with CDN or npm, and self-hosting basics. Load this skill for initial setup and basic usage patterns.
// Quick start for standalone app at livecodes.io, embedding playgrounds with CDN or npm, and self-hosting basics. Load this skill for initial setup and basic usage patterns.
Use SDK with React, Vue, Svelte, Solid, Preact, and Web Components. sdkReady callback pattern, reactive props, and framework-specific setup. Load this skill when embedding LiveCodes in a framework application.
Create and configure embedded playgrounds using createPlayground(), EmbedOptions, container setup, loading modes (eager/lazy/click), and appUrl for self-hosted instances. Load this skill when embedding LiveCodes in web pages, configuring playground containers, or setting up SDK integration.
Open-source, client-side code playground supporting 90+ languages/frameworks. Runs entirely in the browser with SDK for embedding. Entry point for all LiveCodes skills.
Configure playground behavior through Config object, query parameters, EmbedOptions, editor settings, processors, external resources, and custom settings. Load this skill when setting up project content, configuring CSS processors, or customizing display.
Configure how the playground is displayed: full, focus, simple, lite, editor, codeblock, and result modes. Load this skill when choosing display mode for embeddings, configuring read-only views, or showing only result or editor.
Use the "Preview in LiveCodes" GitHub Action to generate preview playground links for pull request code changes. Automates playground creation and PR comments.
| name | livecodes/getting-started |
| description | Quick start for standalone app at livecodes.io, embedding playgrounds with CDN or npm, and self-hosting basics. Load this skill for initial setup and basic usage patterns. |
| type | lifecycle |
| library | livecodes |
| library_version | 0.13.0 |
| sources | ["live-codes/livecodes:README.md","live-codes/livecodes:docs/docs/getting-started.mdx"] |
LiveCodes is a client-side code playground that runs in the browser. No server, no build step, no npm install.
<div id="container"></div>
<script type="module">
import { createPlayground } from 'https://cdn.jsdelivr.net/npm/livecodes';
createPlayground('#container', {
params: {
markdown: '# Hello LiveCodes!',
css: 'h1 { color: dodgerblue; }',
js: 'console.log("Hello, from JS!");',
console: 'open',
},
});
</script>
npm install livecodes
import { createPlayground } from 'livecodes';
createPlayground('#container', {
template: 'react',
});
import { createPlayground } from 'livecodes';
createPlayground('#container', {
appUrl: 'https://your-domain.com/livecodes',
template: 'react',
});
createPlayground('#container', {
template: 'react', // react, vue, svelte, solid, angular, etc.
});
// Available templates:
// blank, javascript, typescript, react, react-native, vue, vue2, angular,
// preact, svelte, solid, lit, stencil, mdx, astro, jest, tailwindcss, python, ...
createPlayground('#container', {
config: {
markup: {
language: 'markdown',
content: '# Hello World',
},
style: {
language: 'css',
content: 'h1 { color: blue; }',
},
script: {
language: 'javascript',
content: 'console.log("Hello!");',
},
activeEditor: 'script',
},
params: { console: 'open' },
});
import { getPlaygroundUrl } from 'livecodes';
const url = getPlaygroundUrl({
config: {
markup: { language: 'markdown', content: '# Hello' },
},
});
// Share this URL
window.open(url);
For stable embeds that won't break with updates:
// Use a specific version
createPlayground('#container', {
appUrl: 'https://v48.livecodes.io', // Permanent URL
template: 'react',
});
// SDK version pinning
import { createPlayground } from 'https://cdn.jsdelivr.net/npm/livecodes@0.13.0';
// Minimal embed for docs
createPlayground('#container', {
params: {
js: `console.log("Hello World")`,
console: 'open',
},
loading: 'lazy', // Load when visible
});
// Or use markdown plugins (remark-livecodes, etc.)
// See: markdown-integration skill
// Simple, focused display
createPlayground('#container', {
config: {
mode: 'simple',
layout: 'vertical',
},
params: {
html: '<h1>Hello</h1>',
css: 'h1 { color: blue; }',
},
});
// Show code with tests
createPlayground('#container', {
template: 'jest',
params: { tests: 'open' },
});
// Read-only code review
createPlayground('#container', {
config: {
mode: 'codeblock',
readonly: true,
},
params: { html: '<h1>Review this code</h1>' },
});
// Result only
createPlayground('#container', {
params: {
mode: 'result',
template: 'react',
},
});
// Demo with console
createPlayground('#container', {
params: {
mode: 'result',
tools: 'console|full',
js: 'console.log("Demo output")',
},
});
import LiveCodes from 'livecodes/react';
export default function App() {
return <LiveCodes template="react" height="400px" />;
}
<script setup>
import LiveCodes from 'livecodes/vue';
</script>
<template>
<LiveCodes template="vue" height="400px" />
</template>
<script>
import LiveCodes from 'livecodes/svelte';
</script>
<LiveCodes template="svelte" height="400px" />
import LiveCodes from 'livecodes/solid';
function App() {
return <LiveCodes template="solid" height="400px" />;
}
<script src="https://cdn.jsdelivr.net/npm/livecodes/web-components.js"></script>
<live-codes template="react" height="400px"></live-codes>
| Template | Description |
|---|---|
blank | Empty project |
javascript | Vanilla JavaScript |
typescript | TypeScript |
react | React |
vue | Vue 3 SFC |
svelte | Svelte SFC |
solid | Solid |
angular | Angular |
preact | Preact |
tailwindcss | Tailwind CSS |
bootstrap | Bootstrap |
python | Python |
python-wasm | Python (WASM) |
jest | Jest tests |
jest-react | Jest + React Testing Library |
See Full Template List for all 70+ templates.
sdk-embedding skillsdk-methods skillconfiguration skilllanguage-support skillmodule-resolution skillself-hosting skillmarkdown-integration skill