Code Window
interlace-ui/code-windowFreeComponent
macOS-style window chrome for wrapping editor, terminal, or code-preview content: a bordered `bg-card` box plus an optional title bar with the three traffic-light dots, a centred monospace filename, and an actions slot.
Install it
npx shadcn@latest add https://ds.interlace.tools/r/code-window.jsonSource
1'use client';23import * as React from 'react';45// @interlace/code-window v1.2.0 — Interlace design system.6// Docs, props and live preview: https://ds.interlace.tools/c/code-window7// What changed since: https://ds.interlace.tools/c/code-window#history8// Generated banner — keep it, the upgrade diff reads this version.910/**11 * @interlace/ui — CodeWindow + CodeWindowTitleBar12 *13 * macOS-style window chrome for wrapping editor, terminal, or code-preview14 * content: a bordered `bg-card` box plus an optional title bar with the three15 * traffic-light dots, a centred monospace filename, and an actions slot.16 *17 * It is chrome only — it renders whatever you nest inside it and has no18 * opinion about the content.19 *20 * Modeled on MagicUI's `Terminal` chrome (the dots + bar layout convention)21 * but reduced to the visual primitive — no animation, no terminal-specific22 * line emitter. Reach for MagicUI's `Terminal` when you want the typed-prompt23 * animation; reach for this when you want a window-shaped container.24 *25 * ## Anatomy26 *27 * CodeWindow (div — data-slot="code-window")28 * ├─ CodeWindowTitleBar (div — data-slot="code-window-title-bar")29 * │ ├─ span aria-hidden (data-slot="code-window-traffic-lights")30 * │ │ └─ 3 × span size-3 (bg-window-control-close/-minimize/-zoom)31 * │ ├─ span (title — centred, font-mono text-xs)32 * │ └─ span (actions — ml-auto)33 * └─ children (the body: editor, <pre>, anything)34 *35 * ## No accessible name, deliberately36 *37 * The root is a bare `<div>`: no role, no label. That is the correct shape for38 * this component rather than a gap in it. It claims no role, so ARIA requires39 * it to expose no name — and an `aria-label` on a roleless `<div>` is ignored40 * by most of the mapping specs anyway, so adding one would buy a false sense41 * of coverage. Nothing is hidden either: the dots are `aria-hidden` because42 * they are ornament, while the `title` slot is an ordinary `<span>` whose text43 * is read in document order like any other text, and the body renders whatever44 * you nest with its own semantics intact.45 *46 * If a particular window needs to be announced AS a region — a labelled47 * landmark a screen-reader user can jump to — that is a call-site decision48 * about that page's structure, so give it a role and a name there. Baking one49// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Accordionaccordion | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps |
