Section

Code Playground — Vercel

Refined dark monochrome code playground with hairline borders, a subtle radial glow, and a teal status dot. A tabbed editor pane (HTML/JS/CSS) with line numbers sits beside a live sandboxed iframe output, plus a single white wired Run button and reset control.

  • Section
  • Tailwind
  • HTML
  • MIT

What it does

Capabilities

  • Dark monochrome surfaces with hairline borders
  • Teal glowing status dot
  • Subtle masked grid backdrop behind title
  • File tab switcher (HTML/JS/CSS)
  • Line-numbered code editor
  • Wired Run button renders sandboxed iframe
  • Live char + line counters
  • Reset control restores defaults
  • Keyboard accessible controls

Preview

Live section

Interactive preview
Open preview
9:41 100%
devsnips.site/library/tailwind/sections/developer/code-playground/vercel/
fluid · no fixed width 100%
Dependencies: Tailwind CSS (CDN) · Google Fonts: Geist, Geist Mono Responsive · Keyboard-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Sections/Developer/code-playground/vercel
registry path: Tailwind/Sections/Developer/code-playground/vercel

Source

Implementation

code.html
<!--
Snippet Name: Code Playground — Vercel
Description: Refined dark monochrome code editor + live output playground with hairline borders, a teal status dot, file tabs, line numbers, and a wired Run button.
Author: DevSnips Contributors
Usage Example: Drop into a dark product shell as a live code editor surface. The Run button renders the active file into a sandboxed iframe; tabs switch files.
-->
<div class="relative w-full max-w-5xl" data-playground="vc">

  <!-- Panel -->
  <div class="overflow-hidden rounded-[14px] border border-white/10 bg-[#0a0a0a] shadow-[0_0_0_1px_rgba(255,255,255,0.02),0_20px_60px_-20px_rgba(0,0,0,0.9)]">

    <!-- Header -->
    <div class="flex items-center justify-between gap-3 border-b border-white/[0.07] px-5 py-4">
      <div class="flex items-center gap-3">
        <div class="flex h-9 w-9 items-center justify-center rounded-lg border border-white/10 bg-white text-black">
          <svg class="h-4 w-4" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2 2 19h20L12 2z"/></svg>
        </div>
        <div class="leading-tight">
          <p class="font-g text-[13px] font-medium text-white">Playground</p>
          <p class="vc-mono mt-0.5 text-[11px] text-white/40">
            <span class="vc-dot"></span>sandbox · v2
          </p>
        </div>
      </div>
      <div class="flex items-center gap-1.5">
        <button type="button" aria-label="Reset code" class="pg-reset flex h-8 w-8 items-center justify-center rounded-md text-white/50 transition-colors hover:bg-white/[0.06] hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30">
          <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7M3 4v4h4" /></svg>
        </button>
        <button type="button" class="pg-run flex shrink-0 items-center gap-2 rounded-md border border-white/10 bg-white px-4 py-2 font-g text-[13px] font-medium text-black transition-colors hover:bg-white/90 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40">
          <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M6 4l14 8-14 8z" /></svg>
          Run
        </button>
      </div>
    </div>

    <!-- File tabs -->
    <div class="flex items-stretch overflow-x-auto border-b border-white/[0.07] bg-[#0a0a0a]" role="tablist" aria-label="Editor files">
      <button type="button" role="tab" aria-selected="true" data-tab="html" class="pg-tab flex items-center gap-2 border-b-2 border-white px-4 py-2.5 vc-mono text-[12px] text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-inset">
        <span class="h-2 w-2 rounded-full bg-[#ff4fa3]"></span>index.html
      </button>
      <button type="button" role="tab" aria-selected="false" data-tab="js" class="pg-tab flex items-center gap-2 border-b-2 border-transparent px-4 py-2.5 vc-mono text-[12px] text-white/50 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-inset">
        <span class="h-2 w-2 rounded-full bg-[#50e3c2]"></span>app.js
      </button>
      <button type="button" role="tab" aria-selected="false" data-tab="css" class="pg-tab flex items-center gap-2 border-b-2 border-transparent px-4 py-2.5 vc-mono text-[12px] text-white/50 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-inset">
        <span class="h-2 w-2 rounded-full bg-[#00c2ff]"></span>styles.css
      </button>
      <span class="ml-auto self-center pr-4 vc-mono text-[11px] text-white/30">UTF-8 · LF</span>
    </div>

    <!-- Editor + Output -->
    <div class="grid grid-cols-1 lg:grid-cols-2">

      <!-- Editor -->
      <div class="border-b border-white/[0.07] lg:border-b-0 lg:border-r">
        <div class="flex items-center justify-between border-b border-white/[0.07] px-4 py-2">
          <p class="vc-mono text-[11px] uppercase tracking-wider text-white/35">Editor</p>
          <p class="pg-status vc-mono text-[11px] uppercase tracking-wider text-white/35">Ready</p>
        </div>
        <div class="flex h-[360px] bg-[#0a0a0a]">
          <pre class="pg-lines select-none border-r border-white/[0.07] px-3 py-3 text-right vc-mono text-[13px] leading-[1.5] text-white/25" aria-hidden="true">1
2
3
4
5
6
7
8
9
10
11
12</pre>
          <textarea
            class="pg-code w-full resize-none bg-[#0a0a0a] px-4 py-3 vc-mono text-[13px] leading-[1.5] text-white/90 placeholder:text-white/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/20 focus-visible:ring-inset"
            spellcheck="false"
            autocomplete="off"
            autocapitalize="off"
            aria-label="Code editor"
            data-lang="html"
          ></textarea>
        </div>
      </div>

      <!-- Output -->
      <div>
        <div class="flex items-center justify-between border-b border-white/[0.07] px-4 py-2">
          <p class="vc-mono text-[11px] uppercase tracking-wider text-white/35">Output</p>
          <p class="pg-render-time vc-mono text-[11px] uppercase tracking-wider text-white/35">— ms</p>
        </div>
        <div class="h-[360px] bg-[#050505] p-2">
          <iframe
            title="Rendered output"
            class="pg-output h-full w-full rounded-md border border-white/10 bg-white"
            sandbox="allow-scripts"
            srcdoc="<!DOCTYPE html><html><head><meta charset=&quot;utf-8&quot;><style>body{font-family:system-ui,sans-serif;padding:16px;margin:0;color:#111}</style></head><body><p style=&quot;opacity:.5&quot;>Press <b>Run</b> to render.</p></body></html>"
          ></iframe>
        </div>
      </div>
    </div>

    <!-- Footer / status -->
    <div class="flex flex-wrap items-center justify-between gap-2 border-t border-white/[0.07] px-5 py-3">
      <p class="vc-mono text-[11px] text-white/50">
        <span class="pg-count">0</span> chars · <span class="pg-lines-count">0</span> lines
      </p>
      <p class="vc-mono text-[11px] text-white/30">runtime: browser sandbox</p>
    </div>
  </div>

  <style>
    [data-playground="vc"] .vc-mono { font-family: 'Geist Mono', ui-monospace, monospace; }
    [data-playground="vc"] .font-g { font-family: 'Geist', sans-serif; }
    [data-playground="vc"] .vc-dot { display: inline-block; height: 6px; width: 6px; border-radius: 9999px; background: #50e3c2; margin-right: 5px; box-shadow: 0 0 8px #50e3c2; vertical-align: middle; }
    [data-playground="vc"] .pg-code { tab-size: 2; }
    [data-playground="vc"] .pg-code::-webkit-scrollbar { width: 8px; height: 8px; }
    [data-playground="vc"] .pg-code::-webkit-scrollbar-track { background: transparent; }
    [data-playground="vc"] .pg-code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 9999px; }
    [data-playground="vc"] .pg-code { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
  </style>

  <script>
    (function () {
      var root = document.currentScript.closest('[data-playground="vc"]');
      if (!root) return;

      var files = {
        html: '<div class="card">\n  <h1>Hello, DevSnips</h1>\n  <p>Edit the HTML, then hit Run.</p>\n  <button onclick="bump()">Clicked 0 times</button>\n</div>',
        js: 'var n = 0;\nfunction bump() {\n  n += 1;\n  var b = document.querySelector("button");\n  b.textContent = "Clicked " + n + " times";\n  b.style.background = n % 2 ? "#50e3c2" : "#00c2ff";\n}',
        css: '.card {\n  font-family: system-ui, sans-serif;\n  padding: 24px;\n  max-width: 320px;\n  border: 1px solid #eaeaea;\n  border-radius: 12px;\n}\nh1 { margin: 0 0 8px; font-size: 20px; }\nbutton {\n  margin-top: 12px; border: 1px solid #000;\n  border-radius: 8px; padding: 8px 14px; cursor: pointer;\n}'
      };

      var codeEl = root.querySelector('.pg-code');
      var output = root.querySelector('.pg-output');
      var runBtn = root.querySelector('.pg-run');
      var resetBtn = root.querySelector('.pg-reset');
      var tabs = root.querySelectorAll('.pg-tab');
      var status = root.querySelector('.pg-status');
      var renderTime = root.querySelector('.pg-render-time');
      var countEl = root.querySelector('.pg-count');
      var linesCountEl = root.querySelector('.pg-lines-count');
      var linesEl = root.querySelector('.pg-lines');
      var current = 'html';

      function escapeHtml(s) {
        return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
      }

      function setLines(n) {
        var out = [];
        for (var i = 1; i <= Math.max(n, 1); i++) out.push(i);
        linesEl.textContent = out.join('\n');
      }

      function updateStats() {
        var v = codeEl.value;
        var lines = v.split('\n').length;
        countEl.textContent = v.length;
        linesCountEl.textContent = lines;
        setLines(lines);
      }

      function load(tab) {
        current = tab;
        codeEl.value = files[tab];
        codeEl.dataset.lang = tab;
        updateStats();
        tabs.forEach(function (t) {
          var on = t.dataset.tab === tab;
          t.setAttribute('aria-selected', on ? 'true' : 'false');
          t.className = on
            ? 'pg-tab flex items-center gap-2 border-b-2 border-white px-4 py-2.5 vc-mono text-[12px] text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-inset'
            : 'pg-tab flex items-center gap-2 border-b-2 border-transparent px-4 py-2.5 vc-mono text-[12px] text-white/50 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-inset';
        });
      }

      function run() {
        var t0 = performance.now();
        var html = files.html;
        var css = files.css;
        var js = files.js;
        if (current === 'html') html = codeEl.value;
        if (current === 'css') css = codeEl.value;
        if (current === 'js') js = codeEl.value;
        var doc = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>' +
          escapeHtml(css) + '</style></head><body>' + escapeHtml(html) +
          '<' + 'script>' + js + '<' + '/script></body></html>';
        output.srcdoc = doc;
        var dt = Math.round(performance.now() - t0);
        renderTime.textContent = dt + ' ms';
        status.textContent = 'Rendered';
      }

      runBtn.addEventListener('click', run);
      resetBtn.addEventListener('click', function () { load(current); run(); });
      tabs.forEach(function (t) {
        t.addEventListener('click', function () { load(t.dataset.tab); });
      });
      codeEl.addEventListener('input', updateStats);

      load('html');
      run();
    })();
  </script>
</div>
203 lines UTF-8 · LF · Spaces: 2
DevSnips AI ready Claude · Cursor · Windsurf

Agent skill & Model Context Protocol

Pass this section straight into your AI workflow. DevSnips exposes each resource as a structured, addressable registry entry, so your agent installs the real files instead of approximating them.

devsnips://sections/developer/code-playground/vercel
Prompt instruction
I want to use this DevSnips resource in production:

Page:
https://devsnips.site/library/tailwind/sections/developer/code-playground/vercel/

Install: npx devsnips add
Tailwind/Sections/Developer/code-playground/vercel

This is the Code Playground — Vercel — Refined dark monochrome code playground with hairline borders, a subtle radial glow, and a teal status dot. A tabbed editor pane (HTML/JS/CSS) with line numbers sits beside a live sandboxed iframe output, plus a single white wired Run button and reset control.

Use this DevSnips resource as the starting point for my project.
Adapt it to my project's stack and conventions, fix any issues,
and make it production-ready while preserving its intended design
and behavior.

Paste into ChatGPT, Claude or your agent — it already carries the page URL and the exact install path.

Resource URI
devsnips://sections/developer/code-playground/vercel