Sandbox

Component for easy embeding CodeSandbox/StackBlitz in your documentation with great performances.

It's using the IntersectionObserver to load when visible in the viewport.

You can either provide a src prop with the URL of the sandbox or a repo prop with the repository name (it will render both CodeSandbox and StackBlitz).

Loading Sandbox...
MDC
:sandbox{src="https://codesandbox.io/embed/nuxt-content-l164h?hidenavigation=1&theme=dark"}

Props

PropsTypeDefaultDescription
srcString''The URL of the sandbox.
repoString''The repository of the sandbox.
branchString''The branch of the sandbox.
dirString''The directory of the sandbox.
fileStringapp.vueThe directory of the sandbox.

Design Tokens

tokens.config.ts
import { defineTheme } from 'pinceau'

export default defineTheme({
  elements: {
    sandbox: {
      backgroundColor: '{elements.surface.primary.backgroundColor}',
      height: '700px',
      fontSize: '{text.3xl.fontSize}',
      lineHeight: '{text.3xl.lineHeight}',
      borderWidth: '1px',
      borderStyle: 'solid',
      borderColor: '{elements.border.secondary.static}',
      borderRadius: '{radii.md}',
    },
  }
})