Skip to content

Commit

Permalink
feat: Update devbox embedding description + add sandboxes (#217)
Browse files Browse the repository at this point in the history
* feat: Update devbox embedding description + add sandboxes

Embed a devbox in docs, blog posts, Medium, and other websites. Additionally, Devbox embeds still lack some of the customization options that are available in legacy sandbox embeds.

* fix: fix typos and improve wording

---------

Co-authored-by: Filipe Lima <45261568+filipelima18@users.noreply.github.com>
  • Loading branch information
tromika and filipelima18 authored Dec 11, 2023
1 parent 82818fa commit 3f50318
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 7 deletions.
5 changes: 0 additions & 5 deletions packages/projects-docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,6 @@ module.exports = withNextra({
destination: "/learn/legacy-sandboxes/deployment",
permanent: false,
},
{
source: "/learn/sandboxes/embedding",
destination: "/learn/legacy-sandboxes/embedding",
permanent: false,
},
{
source: "/learn/sandboxes/live-sessions",
destination: "/learn/legacy-sandboxes/live-sessions",
Expand Down
4 changes: 2 additions & 2 deletions packages/projects-docs/pages/learn/devboxes/embedding.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Embedding
authors: ['CompuIves']
description: Embed a sandbox in docs, blog posts, Medium, and other websites.
description: Embed a devbox in docs, blog posts, Medium, and other websites.
---

import { Callout } from 'nextra-theme-docs'
Expand Down Expand Up @@ -77,4 +77,4 @@ As Devbox embeds are in beta, some more advanced options are currently unavailab

Notably, the embed viewer cannot make changes to the sandbox before forking it, so inline editing is not currently supported on these embeds.

Additionally, Devbox embeds still lack some of the customization options that are available in browser sandbox embeds.
Additionally, Devbox embeds still lack some of the customization options that are available in legacy sandbox embeds.
1 change: 1 addition & 0 deletions packages/projects-docs/pages/learn/sandboxes/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"editor-features": "Editor Features",
"templates": "Templates",
"cli-api": "CLI & API",
"embedding": "Embedding",
"custom-npm-registry": "Custom NPM Registry",
"faq": "FAQ"
}
74 changes: 74 additions & 0 deletions packages/projects-docs/pages/learn/sandboxes/embedding.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Embedding
authors: ['CompuIves']
description: Embed a sandbox in docs, blog posts, Medium, and other websites.
---

import { Callout } from 'nextra-theme-docs'
import Video from '../../../../../shared-components/Video'

# Embedding

## What is an Embed?

An embed lets you include a running sandbox in your documentation, blog post, or
website.

### Embedding Sandboxes

Sandbox embeds enhance the learning and reading experience for anyone by providing a practical, interactive, and hassle-free way to explore and experiment with code examples. In addition, embeds allow users to interact with code examples directly from an article or blog post, from where users can directly run, modify, and experiment with the code in a live environment. Also, embeds can be a great solution if you want to show examples of applications.


<Callout>
Embeds for Sandboxes are currently in beta.
</Callout>

## Generate an Embed URL

You can generate a URL to embed by clicking the `Share` button inside the editor of a Sandbox and then clicking on 'Copy embed code'.

This will give you HTML code with an iFrame that you can paste into your content.

![Devbox Embed](../images/embed-cloud-sandbox.jpg)


## Example Embed

Below is an example of the iFrame to embed a React sandbox:

```html
<iframe
style={{
width: "100%",
height: 900,
outline: "1px solid #252525",
border: 0,
borderRadius: 8,
marginBottom: 16,
zIndex: 100
}}
src="https://codesandbox.io/p/sandbox/react-new?file=/src/index.js"
></iframe>
```

This code outputs the following embed:

<iframe
style={{
width: "100%",
height: 900,
outline: "1px solid #252525",
border: 0,
borderRadius: 8,
marginBottom: 16,
zIndex: 100
}}
src="https://codesandbox.io/p/sandbox/react-new?file=/src/index.js"
></iframe>

## Limitations
As Sandbox embeds are in beta, some more advanced options are currently unavailable.

Notably, the embed viewer cannot change the sandbox before forking it, so inline editing is not currently supported on these embeds.

Additionally, Sandbox embeds still lack some of the customization options available in legacy sandbox embeds.

1 comment on commit 3f50318

@vercel
Copy link

@vercel vercel bot commented on 3f50318 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.