AiSandbox
Sandbox
Runnable code sandbox preview.
Model picker
const models = ['gpt-4o', 'claude-sonnet', 'gemini-pro']
const picked = models[Math.floor(Math.random() * models.length)]
console.log('Selected:', picked)Output
Usage
<AiSandbox
:code="snippet"
language="javascript"
title="Model picker"
:auto-run="true"
>
<template #header="{ title, run, isRunning }">
</template>
<template #editor="{ code, language }">
</template>
<template #output="{ iframeHtml, frameVersion, error }">
</template>
</AiSandbox>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| code* | string | — | — |
| language | string | 'html' | html, javascript, or js |
| template | string | — | Custom iframe HTML; use {{code}} as placeholder |
| title | string | — | Accessible label and header title |
| autoRun | boolean | false | Emit run on mount (refreshes JS iframe) |
Slots
defaultheadertitleeditoroutput