# Embedding Shelley

You can embed Shelley in your app, providing really fast iteration. In Shelley, press ⌘K and choose **Edit with Shelley**. It shows an HTML snippet, with your Shelley's address, to add to your pages: a button that opens Shelley in a frame beside the page, with no script ([edit-with-shelley.html](https://github.com/boldsoftware/shelley/blob/main/embed/edit-with-shelley.html)):

```html
<!-- Edit with Shelley: a button that opens Shelley beside this page.
     Only people who can sign in to your Shelley can use it,
     so show it only to them (for example, only to your admins). -->
<details class="edit-with-shelley">
  <summary>Edit with Shelley</summary>
  <iframe src="https://shelley.example.com/" title="Shelley" loading="lazy"
    allow="clipboard-read; clipboard-write; microphone; display-capture"></iframe>
</details>
<style>
  .edit-with-shelley { position: fixed; top: 12px; right: 12px; z-index: 2147483647; font: 600 13px system-ui, sans-serif; }
  .edit-with-shelley summary { list-style: none; cursor: pointer; padding: 8px 14px; border: 1px solid #8885;
    border-radius: 99px; background: Canvas; color: CanvasText; box-shadow: 0 2px 10px #0002; }
  .edit-with-shelley summary::-webkit-details-marker { display: none; }
  .edit-with-shelley iframe { position: fixed; top: 0; right: 0; width: min(480px, 100vw); height: 100%;
    box-sizing: border-box; border: 0; border-left: 1px solid #8884; background: Canvas; }
  .edit-with-shelley[open] { right: calc(min(480px, 100vw) + 12px); }
  @media screen and (min-width: 900px) { html:has(.edit-with-shelley[open]) { margin-right: 480px !important; } }
  @media (max-width: 899px) {
    .edit-with-shelley[open] { right: 12px; }
    .edit-with-shelley iframe { top: 58px; height: calc(100% - 58px); }
  }
  @media print { .edit-with-shelley { display: none; } }
</style>
```

Then add your site below it, as `https://app.example.com`. If your pages' Content-Security-Policy forbids inline styles, move the `<style>` into your stylesheet.

On [exe.dev](https://exe.dev/), the snippet frames `https://<vm>.shelley.exe.xyz/`, and any page your VM serves may show it. The first time, the frame asks you to connect.

Embedding has security implications. Be sure that you trust the host app and that you have appropriate authentication and authorization in place.

<figure class="shot">
<picture>
<source srcset="/media/embed-dark.png" media="(prefers-color-scheme: dark)">
<img src="/media/embed-light.png" width="1280" height="760" loading="lazy" alt="A small to-do app with Shelley docked on the right, asked to give the app a dark mode, showing its edit to the page's CSS.">
</picture>
</figure>
