Skip to content

Live Code Editor

Experience the power of VS Code’s Monaco Editor integrated directly into our documentation. This interactive code editor provides full TypeScript support, IntelliSense, error checking, and syntax highlighting.

  • Full TypeScript language service
  • Real-time error checking and IntelliSense
  • Auto-completion and parameter hints
  • Type checking with immediate feedback
  • Light theme (default)
  • Dark theme (vs-dark)
  • Matches your documentation site theme
  • Lazy-loaded for optimal page performance
  • Client-side hydration only when needed
  • Graceful fallback for no-JavaScript environments
  • Configurable height and read-only mode
  • Multiple programming languages supported
  • Custom compiler options for advanced use cases
---
import CodeEditorAstro from '../../../components/interactive/CodeEditorAstro.astro'
---
<CodeEditorAstro
defaultValue="const example = 'Hello World!'"
language="typescript"
height={300}
theme="vs-dark"
readOnly={false}
/>
PropTypeDefaultDescription
defaultValuestring''Initial code content
languagestring'typescript'Programming language
theme'light' | 'vs-dark' | string'light'Editor theme
heightnumber | string400Editor height in pixels or CSS string
widthnumber | string'100%'Editor width in pixels or CSS string
readOnlybooleanfalseWhether editor is read-only
lineNumbers'on' | 'off' | 'relative' | 'interval''on'Whether to show line numbers
wordWrap'on' | 'off' | 'wordWrapColumn' | 'bounded''on'Whether to enable word wrap
fontSizenumber14Font size in pixels
minimapbooleanfalseWhether to show the minimap
foldingbooleantrueWhether to show folding controls
tabSizenumber2Tab size in spaces
insertSpacesbooleantrueWhether to use spaces for indentation
enableTypeScriptbooleantrueWhether to enable TypeScript language service
titlestring-Optional title for accessibility

The live code editor includes:

  • Keyboard navigation support
  • Screen reader compatibility
  • High contrast theme support
  • Focus management and ARIA labels
  • Graceful degradation without JavaScript