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
})| Prop | Type | Default | |
|---|---|---|---|
content | string (HTML) | — | Raw HTML slot — pre-highlighted code HTML or plain text |
filename | string | — | Filename shown in the chrome bar (e.g. 'home.js') |
lang | string | — | Language label shown on the right of the chrome (e.g. 'JavaScript') |