GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Embedding guide

Embedding guide

Jump to bottom
David Simon Tetruahsvili edited this page Nov 27, 2026 · 3 revisions

DartPad can be embedded in any web page with a plain iframe. Add embed=true to a DartPad URL to use the compact embed layout.

<iframe
  src="https://dartpad.dev/?sample=counter&amp;embed=true&amp;theme=light"
  title="Flutter counter example"
  width="100%"
  height="600"
  style="border: 0"
  allow="clipboard-read; clipboard-write"
></iframe>

DartPad analyzes and compiles code in the browser, in a WebWorker. No code is sent to a server to compile.

Choose what to load

Each URL loads one project source:

Query Source
sample=<id> Bundled sample: counter, sunflower, fibonacci, flame-game, dart, or flutter
gist=<id> (or id=<id>) GitHub Gist. See the Sharing guide
package=<name> Latest version of a pub.dev package
package=<name>&version=<version> Exact version of a pub.dev package
url=<url> Tar archive, optionally gzip compressed

Optional project settings:

  • file=<path>: open a file in the editor. Repeat it to open several tabs; the first one is active.
  • entrypoint=<path>: the file that Run executes.
  • root=<path>: the directory used for the file tree, analysis, and dependency resolution.
  • sdk=dart or sdk=flutter: the SDK to use. Append :<version> for an exact bundled version.
  • mode=console or mode=flutter: the execution mode.

For example, to embed the example of a pub.dev package:

<iframe
  src="https://dartpad.dev/?package=<name>&amp;root=example&amp;file=example/lib/main.dart&amp;embed=true"
  width="100%"
  height="600"
  style="border: 0"
  allow="clipboard-read; clipboard-write"
></iframe>

Control the layout

Query Effect
embed=true Hide the app bar, footer, and file navigation. The embed waits for Run.
theme=dark or theme=light Initial theme. Without it, DartPad uses the system theme.
panels=<panel-list> Initial panel layout, for example panels=+console,-preview.

panels takes a comma-separated list of console, problems, preview, tabs, filetree, statusbar, and appbar. Prefix each name with + to expand the panel, or - to hide it in an embed. The user can still change the layout after the page loads.

The DartPad README has the full list of query parameters, defaults, and panel rules.

Allow clipboard access

Browsers block clipboard access in cross-origin iframes unless the host page allows it. Add allow="clipboard-read; clipboard-write" to the iframe:

  • clipboard-write is needed for Copy and Cut in the editor context menu, and for copying file paths from the file tree and tabs.
  • clipboard-read is needed for Paste in the editor context menu.

Keyboard shortcuts such as Ctrl+C and Ctrl+V work without these permissions. See Chromium's documentation on permissions in cross-origin iframes for more information.

Performance and multiple embeds

DartPad is resource heavy. Each embed loads an editor, a Dart analyzer, a compiler, and a runtime for the program. A page with many DartPad embeds can use a lot of memory and CPU, especially on mobile devices. If a page needs many examples, consider static code snippets with a link to DartPad, or one embed for the most important example.

To limit the cost, DartPad:

  • Does not run an embed until the user clicks Run.
  • Runs at most two embeds at the same time. When a third embed starts, the embed that was used least recently pauses. A paused embed keeps its code, and the user can click Run to start it again.

The limit is shared by all DartPad embeds in the same browser, including embeds in other tabs.

Legacy embeds

The old /embed-dart.html, /embed-flutter.html, /embed-html.html, and /embed-inline.html style of embedding is no longer supported. Existing Flutter API documentation embeds (embed-flutter.html?sample_id=...) redirect to /?embed=true&sample_id=.... New integrations should use /?embed=true with one of the sources above.

The run query parameter is ignored. Embeds always wait for Run.

Clone this wiki locally

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.