Section
Code Playground — Sharp Glassmorphism
Frosted-glass code playground floating over a vibrant animated gradient mesh. A tabbed editor pane (HTML/JS/CSS) with line numbers sits beside a live sandboxed iframe output, with a cyan glow status dot and a gradient wired Run button. Requires a colored backdrop behind the panel for the glass to read.
- Section
- Tailwind
- HTML
- MIT
What it does
Capabilities
- Frosted-glass panels with backdrop blur
- Animated gradient mesh backdrop
- Gradient primary buttons + cyan glow dot
- Top highlight edge line
- 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
9:41 100%
devsnips.site/library/tailwind/sections/developer/code-playground/sharp-glassmorphism/ fluid · no fixed width 100%
Install
Add to your project
npx devsnips add Tailwind/Sections/Developer/code-playground/sharp-glassmorphism Tailwind/Sections/Developer/code-playground/sharp-glassmorphism <!--
Snippet Name: Code Playground — Sharp Glassmorphism
Description: Frosted-glass code editor + live output playground over a vibrant animated gradient mesh, with file tabs, line numbers, and a wired Run button.
Author: DevSnips Contributors
Usage Example: Drop into a vivid app shell as a live code editor surface. Requires a colored backdrop (e.g. .sg-mesh) behind the panel for the glass to read. The Run button renders the active file into a sandboxed iframe; tabs switch files.
-->
<div class="relative w-full max-w-5xl" data-playground="sg">
<!-- Glass panel -->
<div class="relative overflow-hidden rounded-2xl border border-white/20 bg-white/10 shadow-[0_8px_40px_-12px_rgba(99,102,241,0.45)] backdrop-blur-2xl">
<!-- Top highlight -->
<div class="pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/50 to-transparent" aria-hidden="true"></div>
<!-- Header -->
<div class="flex items-center justify-between gap-3 border-b border-white/15 px-5 py-4">
<div class="flex items-center gap-3">
<div class="sg-glow flex h-10 w-10 items-center justify-center rounded-xl border border-white/30 bg-white/20 text-white backdrop-blur">
<svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M8 9l-3 3 3 3M16 9l3 3-3 3M13 6l-2 12" />
</svg>
</div>
<div class="leading-tight">
<p class="font-sora text-[15px] font-semibold text-white">Playground</p>
<p class="sg-mono mt-1 flex items-center gap-1.5 text-[11px] text-white/70">
<span class="sg-dot"></span> live · sandbox
</p>
</div>
</div>
<div class="flex items-center gap-1.5">
<button type="button" aria-label="Reset code" class="pg-reset flex h-9 w-9 items-center justify-center rounded-lg border border-white/20 bg-white/5 text-white/80 transition-colors hover:bg-white/15 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">
<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 sg-glow flex shrink-0 items-center gap-2 rounded-xl border border-white/30 bg-gradient-to-r from-fuchsia-500 to-indigo-500 px-4 py-2 font-sora text-[13px] font-semibold text-white transition-opacity hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">
<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/15" 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/80 px-4 py-2.5 sg-mono text-[12px] text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60 focus-visible:ring-inset">
<span class="h-2 w-2 rounded-full bg-fuchsia-400"></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 sg-mono text-[12px] text-white/60 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60 focus-visible:ring-inset">
<span class="h-2 w-2 rounded-full bg-cyan-400"></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 sg-mono text-[12px] text-white/60 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60 focus-visible:ring-inset">
<span class="h-2 w-2 rounded-full bg-indigo-400"></span>styles.css
</button>
<span class="ml-auto self-center pr-4 sg-mono text-[11px] text-white/40">UTF-8 · LF</span>
</div>
<!-- Editor + Output -->
<div class="grid grid-cols-1 lg:grid-cols-2">
<!-- Editor -->
<div class="border-b border-white/15 lg:border-b-0 lg:border-r">
<div class="flex items-center justify-between border-b border-white/15 px-4 py-2">
<p class="sg-mono text-[11px] uppercase tracking-wider text-white/55">Editor</p>
<p class="pg-status sg-mono text-[11px] uppercase tracking-wider text-white/55">Ready</p>
</div>
<div class="flex h-[360px] bg-white/[0.06]">
<pre class="pg-lines select-none border-r border-white/15 px-3 py-3 text-right sg-mono text-[13px] leading-[1.5] text-white/35" 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-transparent px-4 py-3 sg-mono text-[13px] leading-[1.5] text-white placeholder:text-white/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40 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/15 px-4 py-2">
<p class="sg-mono text-[11px] uppercase tracking-wider text-white/55">Output</p>
<p class="pg-render-time sg-mono text-[11px] uppercase tracking-wider text-white/55">— ms</p>
</div>
<div class="h-[360px] bg-white/[0.06] p-2">
<iframe
title="Rendered output"
class="pg-output h-full w-full rounded-lg border border-white/15 bg-white"
sandbox="allow-scripts"
srcdoc="<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{font-family:system-ui,sans-serif;padding:16px;margin:0;color:#111}</style></head><body><p style="opacity:.5">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/15 px-5 py-3">
<p class="sg-mono text-[11px] text-white/65">
<span class="pg-count">0</span> chars · <span class="pg-lines-count">0</span> lines
</p>
<p class="sg-mono text-[11px] text-white/40">runtime: browser sandbox</p>
</div>
</div>
<style>
[data-playground="sg"] .sg-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
[data-playground="sg"] .font-sora { font-family: 'Sora', sans-serif; }
[data-playground="sg"] .sg-dot { display: inline-block; height: 6px; width: 6px; border-radius: 9999px; background: #6ee7ff; box-shadow: 0 0 8px #6ee7ff; }
[data-playground="sg"] .sg-glow { box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 4px 20px -4px rgba(168,85,247,0.5); }
[data-playground="sg"] .pg-code { tab-size: 2; }
[data-playground="sg"] .pg-code::-webkit-scrollbar { width: 8px; height: 8px; }
[data-playground="sg"] .pg-code::-webkit-scrollbar-track { background: transparent; }
[data-playground="sg"] .pg-code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 9999px; }
[data-playground="sg"] .pg-code { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent; }
</style>
<script>
(function () {
var root = document.currentScript.closest('[data-playground="sg"]');
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 ? "#d946ef" : "#6366f1";\n}',
css: '.card {\n font-family: system-ui, sans-serif;\n padding: 24px;\n max-width: 320px;\n border-radius: 16px;\n background: linear-gradient(135deg, #d946ef, #6366f1);\n color: #fff;\n}\nh1 { margin: 0 0 8px; font-size: 20px; }\nbutton {\n margin-top: 12px; border: 0; border-radius: 10px;\n padding: 8px 14px; cursor: pointer; font-weight: 700;\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, '&').replace(/</g, '<').replace(/>/g, '>');
}
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/80 px-4 py-2.5 sg-mono text-[12px] text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60 focus-visible:ring-inset'
: 'pg-tab flex items-center gap-2 border-b-2 border-transparent px-4 py-2.5 sg-mono text-[12px] text-white/60 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60 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> 208 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/sharp-glassmorphism I want to use this DevSnips resource in production: Page: https://devsnips.site/library/tailwind/sections/developer/code-playground/sharp-glassmorphism/ Install: npx devsnips add Tailwind/Sections/Developer/code-playground/sharp-glassmorphism This is the Code Playground — Sharp Glassmorphism — Frosted-glass code playground floating over a vibrant animated gradient mesh. A tabbed editor pane (HTML/JS/CSS) with line numbers sits beside a live sandboxed iframe output, with a cyan glow status dot and a gradient wired Run button. Requires a colored backdrop behind the panel for the glass to read. 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/sharp-glassmorphism