Magoo Component UI logo Magoo Component UI
← Catalog

Code Editor Shell

code-editor-shell organism experimental

A read-only editor chrome with file tabs and a numbered gutter for displaying source code.

The width preview needs a screen wider than the chosen width — use a larger device (or a desktop browser) to see the desktop and tablet layouts.

Default
JavaScript
export function greet(name) {  const trimmed = name.trim();  if (!trimmed) {    return "Hello, friend!";  }  return `Hello, ${trimmed}!`;}
CssFile
CSS
:root {  --color-primary: #4f46e5;  --radius-card: 0.75rem;}.card {  border-radius: var(--radius-card);}

Props

NameTypeReq
tabs array ✓
lines array ✓
language string

Related components

How to use

The shell is presentation-only skeleton UI and does not edit or run anything. Clicking a tab marks it active (clearing the others) and dispatches a bubbling CustomEvent "tab:select" with { name }; wire a listener to replace the displayed lines for that file. The line numbers and code are supplied as data (num is precomputed - the directive language does no arithmetic). The portable self-init reads each tab's data-tab attribute; no props object is passed.

Use cases

displaycode WCAG AA SEO 20 dir: ltr ai-generated