Editor and files
The editor is where you write the project’s files, with a file tree, tabs and a status bar. It type checks TypeScript as you type and saves to your browser.
-
Syntax-highlighted editor with themes and light/dark mode, and CSS and HTML highlighted inside
cssandhtmltagged templates.CSS in a
csstagged template and HTML in anhtmlone (Lit, styled-components) are highlighted as CSS and HTML, and the CSS gets hovers, completions and warnings (an unknown property, an empty rule) as in a stylesheet.ReactiveScript files (
.rx) are highlighted as TSX (the highlighter has no ReactiveScript lexer, socomponentandsourceblocks get no colors of their own). With type hints on they also get its compiler’s errors (a write to an equation, an unhandled failure), TypeScript’s type errors, hovers and go to definition, through the same projection to TSX its language server uses; there are no completions in them yet. Format works on them too, thoughbun fmthas no parser for the language: the module goes to it disguised as TSX and comes back only if the compiler finds it the same program (same errors, same projection, same comments and styles), else it stays as it is with a line in the console. It keeps the language’s style (no semicolons, bare arrow parameters) and opens up one-line handlers and blocks; format on save leaves.rxfiles alone.Each file keeps its undo history while the page is open: switching tabs and back, or renaming the file, doesn’t lose it. A file changed outside the editor (by your program, or in an opened folder by another editor) starts a fresh history.
-
File tree with search and a "New file" button; right-click a file or folder to rename or delete it, or press F2 or Delete.
Right-click a file or folder (or use its ⋯ button) to rename or delete it, or to add a file to a folder.
- F2 renames the focused row in place.
- Delete (or Ctrl/Cmd+Backspace) deletes it after asking.
- Open tabs follow a rename and close when their file is deleted; with Watch on, either restarts the program.
For ten seconds after, Undo under the tree (or Ctrl/Cmd+Z in the tree) brings a deleted file or folder back, tabs included, or moves a renamed one back. In an opened folder, both reach the folder on disk.
-
Tabs for open files: close with the × button, Delete, or Ctrl/Cmd+W
-
Auto-save saves your edits a moment after you stop typing (on by default).
Switch it off with the save icon next to Run (in an embed, the tab bar’s Auto-save switch) to save with Ctrl/Cmd+S instead.
Unsaved tabs show a dot, and Run, Install,
bun testand Share save everything first. The setting applies to every project and every open playground tab. -
Format (top right of the code while the pointer is over it, or Shift+Alt+F) formats the open file with
bun fmt, as one undoable edit (see Toolchain) -
Type errors and completions for TypeScript files, plus hovers, go to definition (F12) and parameter hints, from TypeScript 7's checker.
Type errors in TypeScript files, a name’s type and documentation when the pointer rests on it, and completions as you type, come from TypeScript 7’s checker (see Toolchain).
Completions
- The list opens after
., in import paths, and at the first letter of a name; ↑/↓ pick, Enter or Tab insert, Esc closes it. - The selected entry’s type and docs show under the list.
- Names exported by the project’s other files, installed packages and Bun’s and Node’s built-in modules (
bun:sqlite,node:fs) are offered too, with the module they come from, and inserting one adds its import.
Go to definition
Ctrl/Cmd+click a name (or press F12) to go to its definition, in another file too, or in TypeScript’s and Bun’s own types (
lib.es5.d.ts,bun-types), which open read-only in a tab with a lock.Parameter hints
Typing
(or,in a call shows its parameter hints above the line, with the current parameter underlined; ↑/↓ step through overloads and Esc hides them. - The list opens after
-
Changes opens a diff of each file that differs from the project's source, or from the last Git commit once there is one.
Once the project has a Git commit, this compares with the last commit instead (see Git).
- The counter in the status bar shows how many files differ from the project’s source (the demo, the example, the shared link, the GitHub repo, or the folder or zip as opened).
- It opens the Git view (in an embed with Git off, the tab itself), whose Show all changes (or, without a repository, Compare with the project’s source) opens a Changes tab with a diff of each one: modified, added and deleted files, updated as you save.
- Open in a file’s header edits it.
- After a reload the comparison still goes back to the source, not to the restored copy; for a GitHub repo the files are fetched again when the tab first opens.
node_modulesand.gitaren’t compared, and binary files are listed without a diff.
-
Resizable panes
-
Run status shows as a pill in the status bar (default) or a toast over the panes; pick one under Appearance.
The toast fades a few seconds after the program settles; errors stay until the next change.
-
Status bar along the bottom: pane buttons, what the program is doing and its port, the open file's errors and cursor, format on save, install state and save state.
Panes and the program
- Buttons show or hide the file tree, the preview, the console and the debugger (with both of those hidden, the editor takes their room).
- What the program is doing and the port it serves (
:3000; click to show the preview when it’s hidden; with several,:3000 +1opens a list of them that picks the one the preview shows).
The open file
Its error and warning counts (click to go to the next one), the cursor’s line and column, and its language (for TypeScript, with the version the type checker follows).
Saving and installing
- Format on save (the wand): saving with Ctrl/Cmd+S runs
bun fmton the file first; saves as you type don’t, and a filebun fmtcan’t format saves as it is. - Whether the dependencies are installed (how many; Not installed installs them; bun.lock out of date means
package.jsonchanged since the lockfile was written, and an install here follows the lockfile, so delete it to install frompackage.json). - Whether your edits are saved (to this browser, or to the folder you opened; Not saved when another tab has the project open, which saves it instead).
- On a narrow window the port, format on save, the install state and the save state are left out.
Links
- The Bun version links to Bun compatibility.
- Feedback opens a form that sends a message to us, optionally with an email address to answer, the Bun release and browser, and the open project as a short link (see Privacy).
-
Open folder or Open zip file loads a project from your computer, skipping
node_modulesand.git.A zip whose files all sit in one folder, like GitHub’s downloads, opens that folder. In Chrome, edits to an opened folder are saved back to it, and changes made to it in another editor show up in the playground.
-
In Chrome and Edge, an opened folder stays linked: edits, new files and deletions are saved to it on disk.
node_modulesstays in the browser and the folder’s ownnode_modulesand.gitaren’t touched. A reload opens it again if the browser still allows access; otherwise pick Reopenin the project gallery, which asks once more. Other browsers open a copy.
Large files open and scroll quickly: the editor renders only the lines in view.
Keyboard shortcuts
Section titled “Keyboard shortcuts”| Shortcut | Does |
|---|---|
| Ctrl/Cmd+Enter | Run |
| Ctrl/Cmd+Shift+Enter | Send the preview’s request, from anywhere |
| Ctrl/Cmd+. | Stop the server |
| Ctrl/Cmd+S | Save the file |
| Shift+Alt+F | Format the file with bun fmt (format) |
| F12 | Go to the definition of the name at the cursor (goToDefinition) |
| Ctrl/Cmd+I | Show the type and docs of the name at the cursor (showHover); any key closes it |
| Ctrl+Space | Show completions at the cursor (suggest; Ctrl on macOS too) |
| Ctrl/Cmd+Shift+Space | Show the parameters of the call at the cursor (signatureHelp) |
| Ctrl/Cmd+W, Delete | Close the focused tab |
| F2 | Rename the focused file or folder in the file tree |
| Delete, Ctrl/Cmd+Backspace | Delete the focused file or folder in the file tree (asks first) |
| Ctrl/Cmd+Z (in the file tree) | Undo the last rename or delete |
| Ctrl/Cmd+B | Show or hide the file tree |
| Ctrl/Cmd+Shift+G | Show the Git view in place of the file tree (again: back to the files) |
| Ctrl/Cmd+J | Show or hide the console |
| Ctrl/Cmd+K | Show or hide the preview |
| Esc | Leave the expanded preview |
| F8, F10, F11, Shift+F11 | While the debugger is paused: resume, step over, step into, step out |
They work in the preview page too, and in an embed, where showing or hiding a pane works only for the panes its author didn’t turn off (features="-console").
Change a shortcut: the keyboard button, Edit as JSON and the chord syntax
Recording a new key
- Open the keyboard button in the header, click the pencil next to a command and press the new keys (Esc cancels, Remove unbinds it).
- Changed commands are marked custom with a button to reset them, a key bound to two commands is flagged on both, and Save keeps the changes.
- Keys the browser keeps for itself (Cmd+W, Ctrl+T) can’t be recorded.
Edit as JSON
Under Edit as JSON the same overrides can be written by hand: a command name to a chord, a list of chords, or null to turn it off, e.g. { "run": ["Mod+Enter", "Alt+R"], "togglePreview": null }. Mod is Cmd on macOS and Ctrl elsewhere; the other modifiers are Ctrl, Alt, Shift and Meta, and the space bar is Space.
Where they are kept
Overrides are kept in this browser for every project, and open playground tabs pick up changes right away.
Was this page helpful?
Sends the rating and this page's address; nothing else unless you write it. Privacy
runbun is an independent project, not affiliated with or endorsed by Oven or Bun.