GitHub

codeWindow

macOS-style window chrome around a code block. Accepts pre-highlighted HTML as the content slot — the component handles all the chrome, layout, scrolling, and monospace typography.

export default {
  state: { count: 0 },

  view: (state) => `
    <h1>${state.count}</h1>
    <button data-event="inc">+</button>
  `,

  mutations: {
    inc: (state) => ({ count: state.count + 1 }),
  },
}
codeWindow({
  filename: 'home.js',
  lang:     'JavaScript',
  content:  highlightedHtml, // pre-rendered HTML with syntax token spans
})
PropTypeDefault
contentstring (HTML)Raw HTML slot — pre-highlighted code HTML or plain text
filenamestringFilename shown in the chrome bar (e.g. 'home.js')
langstringLanguage label shown on the right of the chrome (e.g. 'JavaScript')