Help

A quick reference for navigating editors, naming documents, keeping browser data, and sharing code.

Keyboard shortcuts

ShortcutAction
Ctrl/⌘ + BOpen the command palette from anywhere.
Ctrl/⌘ + EnterRun the current editor.
Ctrl/⌘ + Shift + EnterStop execution when the editor supports it.
F6 / Shift + F6Switch focus between the code editor and terminal.
EscapeLeave the code editor, or close the command palette.

Inside the command palette, use the arrow keys to select, Enter to run, and Escape to close. Tab remains inside the palette.

Slugs and autosave

Add a filename after an editor route to create a named local document. Different slugs can be open in separate browser tabs and keep independent source.

/js-editor/my-demo.js
/py-editor/data-check.py
/html-editor/landing-page.html

ToyCode loads editor source in this order:

  1. Code embedded in a shared URL fragment.
  2. Source previously autosaved locally for the slug.
  3. A hosted ToyCode template with that slug.
  4. An empty editor when the slug cannot be found.

Edits are saved to IndexedDB after about one second. Two browser tabs using the same slug share that saved document, so the last edit saved wins. Use a distinct filename for each document and across editor types.

Runtime storage

Runtime storage is separate from editor-source autosave. Code can use the global asynchronous storage API to keep files and values in this browser:

await storage.set('greeting.txt', 'Hello!')
const greeting = await storage.get('greeting.txt')
const names = await storage.list()
await storage.delete('greeting.txt')

Open the Storage UI to inspect, edit, upload, or delete runtime files. This data stays on the current browser and device, is not included in shared code links, and remains until you delete it or clear the site's browser data.

Sharing

Choose Share below an editor or from the command palette. ToyCode compresses the current source into the URL fragment and copies the link to your clipboard.

https://toycode.sh/js-editor/#<compressed-code>
  • The shared code lives in the link; ToyCode does not upload it as a saved document.
  • A shared fragment takes priority over locally saved code when the link opens.
  • The document filename is not carried into the shared link.
  • The recipient runs the code locally in their own browser.