Online Preact playground with TypeScript, modern JSX, hooks, local component imports, and live browser preview.
About Preact
Online Preact playground with TypeScript, modern JSX, hooks, local component imports, and live browser preview.
Runtime: v10.29.7
Features
Preact 10 Support
TypeScript & JSX
Hooks API
Local Component Imports
Live Preview
Vite Project Export
Browser playground limits
• Code runs in a sandboxed browser preview, without Node.js, a backend, or private environment variables.
• The Console prompt can inspect browser globals and the rendered DOM, but not variables scoped inside ES modules or component state.
• Download the project when you need build plugins, server APIs, native modules, or a production dependency workflow.
How to use the Preact playground
Edit a source file from the project explorer — the live preview recompiles automatically.
Add, rename, duplicate or delete project files as needed. Update affected imports after renaming or moving a file.
Use the console for logs and errors, and Format to tidy the active file.
Share the complete project or download a Vite project ZIP with its source files and package.json.
Execution
Run code
Ctrl / ⌘+Enter
Save & run
Ctrl / ⌘+S
Editing
Undo
Ctrl / ⌘+Z
Redo
Ctrl / ⌘+Shift+Z
Select next occurrence
Ctrl / ⌘+D
Delete line
Ctrl / ⌘+Shift+K
Move line up / down
Alt+↑ / ↓
Copy line up / down
Alt+Shift+↑ / ↓
Toggle comment
Ctrl / ⌘+/
Indent line
Ctrl / ⌘+]
Outdent line
Ctrl / ⌘+[
Navigation
Find
Ctrl / ⌘+F
Find & replace
Ctrl / ⌘+H
Go to line
Ctrl / ⌘+G
Go to symbol
Ctrl / ⌘+Shift+O
Selection
Select all
Ctrl / ⌘+A
Select line
Ctrl / ⌘+L
Select all occurrences
Ctrl / ⌘+Shift+L
Terminal
Interrupt / kill process
Ctrl+C
Send EOF (close stdin)
Ctrl+D
Console shortcuts
Press Enter to evaluate, ↑ and ↓ to browse command history, and Ctrl/⌘ + L to clear the console.
src/main.tsx
import { render } from 'preact'
import App from './App'
import './styles.css'
const app = document.getElementById('app')
if (!app) {
throw new Error('App target was not found')
}
render(<App />, app)
src/App.tsx
import { useState } from 'preact/hooks'
import { CounterCard } from './components/CounterCard'
export default function App() {
const [count, setCount] = useState(0)
return (
<main class="app-shell">
<p class="eyebrow">Preact 10 · TypeScript + JSX</p>
<h1>Build tiny, fast components</h1>
<p class="intro">
This playground compiles modern Preact TSX, hooks, CSS, and local
component imports directly in your browser.
</p>
<CounterCard
count={count}
onIncrement={() => setCount((value) => value + 1)}
/>
</main>
)
}
Frequently asked questions
Is the Preact playground free?
Yes. The Preact playground is completely free with no sign-up — write, run and share Preact code in your browser.
Do I need to install anything to run Preact online?
No. The live preview compiles and runs in your browser. After downloading the project, install its dependencies before running it locally.
Can I share or export my Preact code?
Yes. Share creates a link to your project. Download exports a Vite project ZIP with its source files and package.json.
Does the editor support autocomplete and live preview?
It does — a Monaco-powered editor with autocomplete and formatting, a live preview that updates as you type, and a console for logs and errors.