---
title: "Code"
description: "Code mockup component - a terminal window for commands and output: generated prompts that are never copied, tones and highlighted lines, window chrome and titles, line numbers, a cursor, wrapping, surfaces and sizes. CSS only."
slug: "mockup-code"
---

import { DocPage, PageHeader, SkillPanel, SourceFiles, SourceNote, StatesSection, CodeBlock, Demo, DemoCode, ChangelogEntries, ArchBody, StatsClaim, StatsCards, PageOverlay, DocText, DocLink, H2, SkillField, SkillText, SkillRow, SkillGrid, Variant, ApiPill, Dim, CodeCard, TableCard } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="mockup-code" title="Code" component="mockup-code">
  A terminal window for commands and what they print - install steps, CLI docs, a session transcript. Each line is a <code>&lt;pre&gt;</code>; its prompt (<code>$</code>, <code>&gt;</code>, a line number) is generated by CSS, so selecting or copying the window yields the commands alone. Tones, highlighted lines, window chrome with a title, line numbers, a blinking cursor. CSS only, after daisyUI's mockup-code - the <DocLink href="installation.html">installation</DocLink> and <DocLink href="vibe-coding.html">agent-skill</DocLink> guides use it for every command.
</PageHeader>

<SkillPanel component="mockup-code">
  <SkillField label="Native basis">
<SkillText>A <code>.mockup-code</code> of <code>&lt;pre&gt;&lt;code&gt;</code> lines; <code>data-prefix</code> on a line draws its prompt with <code>::before</code> - generated content is never selected or copied.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/attr" title="the prompt from data-prefix"><code>attr()</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_counter_styles/Using_CSS_counters" title="line numbers"><code>counter()</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/user-select" title="prompts never join a selection"><code>user-select</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix" title="highlighted lines"><code>color-mix()</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi" title="commands stay LTR in RTL pages"><code>unicode-bidi</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.mockup-code</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText>Window: <code>data-chrome</code> (<code>mac</code>, <code>none</code>), <code>data-title</code>, <code>data-numbers</code>, <code>data-wrap</code>, <code>data-strike</code>, <code>data-animate</code>, <code>data-variant</code> (<code>muted</code>, <code>outline</code>, <code>primary</code>), <code>data-size</code> (<code>sm</code>, <code>lg</code>); lines: <code>data-prefix</code>, <code>data-tone</code> (<code>success</code>, <code>warning</code>, <code>info</code>, <code>destructive</code>, <code>muted</code>), <code>data-highlight</code> (<code>solid</code>), <code>data-cursor</code>, <code>data-diff</code> (<code>add</code>, <code>remove</code>); <code>&lt;ins&gt;</code> / <code>&lt;del&gt;</code> for word changes.</SkillText>
  </SkillField>

  <SkillField label="Print">
<SkillText>Paper cannot scroll: printed, every line wraps as with <code>data-wrap</code>, and the window prints its colors as designed - a print dialog drops background graphics by default, which left the terminal's light text pale on white paper. An animated diff prints its end state.</SkillText>
  </SkillField>
</SkillPanel>

```html example label="Prompt" schema="none" hint="data-prefix='$' draws the prompt. It is generated content: select the line or copy it - you get the command, never the $."
<div class="mockup-code">
  <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
</div>
```

```html example label="Output and status" schema="none" hint="Lines after the command are its output: data-tone colours them - warning, success, info, destructive, muted - tuned for the dark surface."
<div class="mockup-code">
  <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
  <pre data-prefix=">" data-tone="warning"><code>installing...</code></pre>
  <pre data-prefix=">" data-tone="success"><code>Done!</code></pre>
</div>
```

```html example label="Highlighted lines" schema="none" hint="data-highlight tints a line in its tone; data-highlight='solid' fills it - the error line. Numbers as prefixes label the lines."
<div class="mockup-code">
  <pre data-prefix="1"><code>npm i defuss-shadcn</code></pre>
  <pre data-prefix="2" data-tone="info" data-highlight><code>installing...</code></pre>
  <pre data-prefix="3" data-tone="warning" data-highlight="solid"><code>Error!</code></pre>
</div>
```

```html example label="Without prefix" schema="none" hint="A line without data-prefix has no prompt - plain output, or a file."
<div class="mockup-code">
  <pre><code>without prefix</code></pre>
</div>
```

```html example label="Line numbers and syntax highlighting" schema="none" hint="data-numbers numbers every line without its own prefix - CSS counters, nothing to keep in sync. The colours come from Shiki (the highlighter these docs use): codeToTokens returns one token list per line, which maps one-to-one onto the window's <pre> lines - plain text until it loads, and the numbers and the highlighted line keep working."
<div class="mockup-code" data-numbers data-title="button.html" id="mc-source">
  <pre><code>&lt;button class="btn" data-variant="outline"&gt;</code></pre>
  <pre><code>  Search</code></pre>
  <pre><code>  &lt;kbd class="kbd" data-size="sm"&gt;⌘K&lt;/kbd&gt;</code></pre>
  <pre data-highlight><code>&lt;/button&gt;</code></pre>
</div>
<script type="module">
  import { codeToTokens } from 'https://esm.sh/shiki@3.0.0';
  const lines = [...document.querySelectorAll('#mc-source > pre > code')];
  const { tokens } = await codeToTokens(lines.map((code) => code.textContent).join('\n'), {
    lang: 'html',
    theme: 'github-dark',
  });
  tokens.forEach((line, i) =>
    lines[i].replaceChildren(
      ...line.map((token) => {
        const span = document.createElement('span');
        span.textContent = token.content;
        span.style.color = token.color;
        return span;
      }),
    ),
  );
</script>
```

```html example label="Diff" schema="none" hint="data-diff='remove' and 'add' mark the lines - a generated -/+ in its own sign column, red and green bands; lines without it are context and line up. <del> and <ins> inside a line mark the words that changed. Numbers and the sign column combine."
<div class="mockup-code" data-numbers data-title="button.css">
  <pre><code>.btn {</code></pre>
  <pre><code>  display: inline-flex;</code></pre>
  <pre data-diff="remove"><code>  border-radius: <del>4px</del>;</code></pre>
  <pre data-diff="remove"><code>  background: #111;</code></pre>
  <pre data-diff="add"><code>  border-radius: <ins>var(--radius-md)</ins>;</code></pre>
  <pre data-diff="add"><code>  background: var(--primary);</code></pre>
  <pre data-diff="add"><code>  color: var(--primary-foreground);</code></pre>
  <pre><code>}</code></pre>
</div>
```

```html example label="Multi-line commands" schema="none" hint="One command per line; a command continued with a backslash goes on lines with data-prefix='' - the prompt column stays empty, so everything lines up, and a copy is still a valid shell command."
<div class="mockup-code" data-title="bash">
  <pre data-prefix="$"><code>npx skills add kyr0/defuss-shadcn \</code></pre>
  <pre data-prefix=""><code>  --skill defuss-shadcn \</code></pre>
  <pre data-prefix=""><code>  --agent claude-code</code></pre>
</div>
```

```html example label="Cursor" schema="none" hint="data-cursor adds a blinking block after the line - a prompt waiting for input (still under reduced motion)."
<div class="mockup-code" data-chrome="mac">
  <pre data-prefix="$"><code>bun run deploy</code></pre>
  <pre data-prefix=">" data-tone="success"><code>Released v0.9.3</code></pre>
  <pre data-prefix="$" data-cursor><code></code></pre>
</div>
```

```html example label="Long lines" schema="none" hint="A long line scrolls the window sideways (the lines keep one width, so the scroll is shared); data-wrap wraps instead, with a hanging indent under the prompt."
<div class="flex flex-col gap-4" style="max-width: 32rem">
  <div class="mockup-code">
    <pre
      data-prefix="~"
    ><code>Magnam dolore beatae necessitatibus nemo ipsum itaque sit. Et porro quae qui et et dolore ratione.</code></pre>
  </div>
  <div class="mockup-code" data-wrap>
    <pre
      data-prefix="~"
    ><code>Magnam dolore beatae necessitatibus nemo ipsum itaque sit. Et porro quae qui et et dolore ratione.</code></pre>
  </div>
</div>
```

```html example label="Colors" schema="none" hint="data-variant: muted and outline for a light terminal (the tones darken for contrast), primary for any brand colour."
<div class="flex flex-col gap-4">
  <div class="mockup-code" data-variant="primary">
    <pre><code>can be any color!</code></pre>
  </div>
  <div class="mockup-code" data-variant="muted">
    <pre data-prefix="$"><code>bun run build</code></pre>
    <pre data-prefix=">" data-tone="success"><code>verify: OK</code></pre>
  </div>
  <div class="mockup-code" data-variant="outline">
    <pre data-prefix="$"><code>bun run e2e</code></pre>
    <pre data-prefix=">" data-tone="destructive"><code>1 check failed</code></pre>
  </div>
</div>
```

```html example label="Window and title" schema="none" hint="data-chrome='mac' colours the dots, data-title puts a title in the bar, data-chrome='none' drops the bar."
<div class="flex flex-col gap-4">
  <div class="mockup-code" data-chrome="mac" data-title="zsh - defuss-shadcn">
    <pre data-prefix="~"><code>git status</code></pre>
    <pre data-tone="muted"><code>On branch main - nothing to commit, working tree clean</code></pre>
  </div>
  <div class="mockup-code" data-chrome="none">
    <pre data-prefix="$"><code>bun --version</code></pre>
    <pre><code>1.3.11</code></pre>
  </div>
</div>
```

```html example label="Animated diff" schema="none" hint="data-animate plays the change: removed lines turn red and strike through, then the added lines slide in green, one after another (sibling-index() staggers them; --mockup-code-delay / --mockup-code-stagger tune it). CSS only - the script here only starts it when the window scrolls into view and replays it on click."
<div class="flex flex-col gap-3 items-start">
  <div class="mockup-code w-full" id="diff-demo" data-chrome="mac" data-title="release.md">
    <pre><code>Release 0.9.3</code></pre>
    <pre><code></code></pre>
    <pre data-diff="remove"><code>Search box: planned</code></pre>
    <pre data-diff="remove"><code>Typewriter: planned</code></pre>
    <pre data-diff="add"><code>Search &amp; Filter: a search box with a clear button</code></pre>
    <pre data-diff="add"><code>Typewriter: typed, deleted, cycled</code></pre>
    <pre data-diff="add"><code>Code mockup: git-style diffs</code></pre>
  </div>
  <button class="btn" data-variant="outline" data-size="sm" id="diff-replay">Replay</button>
</div>
<script>
  const win = document.getElementById('diff-demo');
  const play = () => {
    win.removeAttribute('data-animate');
    void win.offsetWidth;
    win.setAttribute('data-animate', '');
  };
  new IntersectionObserver((entries, io) => {
    if (entries.some((e) => e.isIntersecting)) {
      play();
      io.disconnect();
    }
  }).observe(win);
  document.getElementById('diff-replay').addEventListener('click', play);
</script>
```

```html example label="Sizes" schema="none" hint="data-size sm · (default) · lg - text, padding and the bar scale together."
<div class="flex flex-col gap-4">
  <div class="mockup-code" data-size="sm">
    <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
  </div>
  <div class="mockup-code">
    <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
  </div>
  <div class="mockup-code" data-size="lg">
    <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
  </div>
</div>
```

```html example label="In a right-to-left page" schema="none" hint="Commands read left to right everywhere: the window isolates its direction, so an Arabic page still shows the shell as it is typed."
<div dir="rtl" lang="ar" class="flex flex-col gap-2">
  <p class="text-sm m-0">ثبّت الحزمة:</p>
  <div class="mockup-code">
    <pre data-prefix="$"><code>npm i defuss-shadcn</code></pre>
  </div>
</div>
```

<SourceFiles component="mockup-code" section="css" />

</DocPage>
