Skip to main content

Embed SDK

JavaScript SDK for embedding and controlling YaliCode editors programmatically.

Installation

Include the SDK via script tag or install from npm:

<script src="https://yalicode.dev/sdk.js"></script>

Or with npm:

npm install @yalicode/sdk

Embed a project

YaliCode.embed('#editor', {
  project: 'PROJECT_ID',
  theme: 'dark',
  height: '500px',
  showFileTree: true,
  showTerminal: false,
  editable: true,
  autoRun: false,
})

Create a playground

YaliCode.create('#editor', {
  language: 'python',
  code: 'print("Hello from YaliCode!")',
  theme: 'dark',
  height: '400px',
})

Options

OptionTypeDescription
projectstringProject ID to embed
languagestringLanguage for playground mode
codestringInitial code for playground mode
theme"dark" | "light" | "auto"Editor theme
heightstringContainer height (CSS value)
showFileTreebooleanShow file tree sidebar
showTerminalbooleanShow terminal panel
editablebooleanAllow code editing
autoRunbooleanRun code on load