Section

Dashboard Overview — Sharp Glassmorphism

Frosted-glass analytics dashboard overview floating over a living animated gradient mesh. Translucent KPI stat cards with trend deltas, a pure-SVG area + line chart, a recent-activity feed, and a wired 7d/30d/90d range selector that swaps hardcoded datasets live. Luminous edges and a gradient primary accent.

  • Section
  • Tailwind
  • HTML
  • MIT

Preview

Live section

Interactive preview
Open preview
9:41 100%
devsnips.dev/library/tailwind/sections/app-ui/dashboard-overview/sharp-glassmorphism/
fluid · no fixed width 100%
Dependencies: Tailwind CSS (CDN) · Google Fonts: Sora, JetBrains Mono Responsive · Keyboard-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Sections/App-UI/dashboard-overview/sharp-glassmorphism
registry path: Tailwind/Sections/App-UI/dashboard-overview/sharp-glassmorphism

Source

Implementation

code.html
<!--
Snippet Name: Dashboard Overview — Sharp Glassmorphism
Description: Frosted-glass analytics dashboard floating over an animated gradient mesh, with KPI stat cards, a pure-SVG area+line chart, an activity feed, and a wired 7d/30d/90d range selector that swaps hardcoded datasets. Requires a colored backdrop behind the panel for the glass to read.
Author: DevSnips Contributors
Usage Example: Drop into a vivid app shell as an analytics overview. The range selector updates KPI values, deltas, and the chart in preview.html. Parent must provide a colored bg.
-->
<div class="relative w-full" data-dash="sg">

  <!-- Glass panel -->
  <div class="relative overflow-hidden rounded-2xl border border-white/20 bg-white/10 shadow-[0_8px_40px_-12px_rgba(168,85,247,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 / toolbar -->
    <div class="relative flex flex-col gap-4 border-b border-white/15 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6">
      <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="M3 17l5-6 4 4 4-6 5 5" /></svg>
        </div>
        <div class="leading-tight">
          <p class="font-sora text-[15px] font-semibold text-white">Overview</p>
          <p class="sg-mono mt-1 flex items-center gap-1.5 text-[11px] text-white/70">
            <span class="sg-dot"></span>live · updated 2m ago
          </p>
        </div>
      </div>

      <div role="group" aria-label="Time range" class="flex w-fit items-center rounded-full border border-white/20 bg-white/5 p-0.5 backdrop-blur">
        <button type="button" data-range="7" class="sg-range rounded-full px-3.5 py-1.5 sg-mono text-[11px] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">7d</button>
        <button type="button" data-range="30" class="sg-range rounded-full px-3.5 py-1.5 sg-mono text-[11px] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">30d</button>
        <button type="button" data-range="90" class="sg-range rounded-full px-3.5 py-1.5 sg-mono text-[11px] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">90d</button>
      </div>
    </div>

    <!-- KPI cards -->
    <div class="grid grid-cols-1 gap-px border-b border-white/15 sm:grid-cols-2 lg:grid-cols-4">
      <div class="px-5 py-5" data-kpi="revenue">
        <div class="flex items-center justify-between">
          <p class="sg-mono text-[11px] uppercase tracking-wider text-white/60">Revenue</p>
          <div class="sg-glow flex h-7 w-7 items-center justify-center rounded-lg border border-white/20 bg-white/15 text-white backdrop-blur">
            <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 1v23M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" /></svg>
          </div>
        </div>
        <p class="mt-3 font-sora text-2xl font-bold leading-none text-white" data-kpi-value>$48,210</p>
        <p class="sg-mono mt-2 flex items-center gap-1.5 text-[11px]" data-kpi-delta>
          <span class="inline-flex items-center gap-1 rounded-full border border-emerald-300/30 bg-emerald-400/15 px-1.5 py-0.5 text-emerald-200">▲ +12.4%</span>
        </p>
      </div>
      <div class="px-5 py-5 sm:border-l sm:border-white/10" data-kpi="users">
        <div class="flex items-center justify-between">
          <p class="sg-mono text-[11px] uppercase tracking-wider text-white/60">Active Users</p>
          <div class="sg-glow flex h-7 w-7 items-center justify-center rounded-lg border border-white/20 bg-white/15 text-white backdrop-blur">
            <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z" /></svg>
          </div>
        </div>
        <p class="mt-3 font-sora text-2xl font-bold leading-none text-white" data-kpi-value>18,402</p>
        <p class="sg-mono mt-2 flex items-center gap-1.5 text-[11px]" data-kpi-delta>
          <span class="inline-flex items-center gap-1 rounded-full border border-emerald-300/30 bg-emerald-400/15 px-1.5 py-0.5 text-emerald-200">▲ +8.1%</span>
        </p>
      </div>
      <div class="px-5 py-5 sm:border-t sm:border-white/10 lg:border-t-0 lg:border-l" data-kpi="mrr">
        <div class="flex items-center justify-between">
          <p class="sg-mono text-[11px] uppercase tracking-wider text-white/60">MRR</p>
          <div class="sg-glow flex h-7 w-7 items-center justify-center rounded-lg border border-white/20 bg-white/15 text-white backdrop-blur">
            <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 3v18h18M7 14l3-3 3 3 5-6" /></svg>
          </div>
        </div>
        <p class="mt-3 font-sora text-2xl font-bold leading-none text-white" data-kpi-value>$12,640</p>
        <p class="sg-mono mt-2 flex items-center gap-1.5 text-[11px]" data-kpi-delta>
          <span class="inline-flex items-center gap-1 rounded-full border border-emerald-300/30 bg-emerald-400/15 px-1.5 py-0.5 text-emerald-200">▲ +5.7%</span>
        </p>
      </div>
      <div class="px-5 py-5 sm:border-t sm:border-white/10 sm:border-l lg:border-t-0" data-kpi="churn">
        <div class="flex items-center justify-between">
          <p class="sg-mono text-[11px] uppercase tracking-wider text-white/60">Churn</p>
          <div class="sg-glow flex h-7 w-7 items-center justify-center rounded-lg border border-white/20 bg-white/15 text-white backdrop-blur">
            <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 12a9 9 0 1 1-3-6.7L21 8" /></svg>
          </div>
        </div>
        <p class="mt-3 font-sora text-2xl font-bold leading-none text-white" data-kpi-value>2.1%</p>
        <p class="sg-mono mt-2 flex items-center gap-1.5 text-[11px]" data-kpi-delta>
          <span class="inline-flex items-center gap-1 rounded-full border border-fuchsia-300/30 bg-fuchsia-400/15 px-1.5 py-0.5 text-fuchsia-100">▼ -0.3pp</span>
        </p>
      </div>
    </div>

    <!-- Chart + activity -->
    <div class="grid grid-cols-1 lg:grid-cols-3">
      <!-- Chart -->
      <div class="border-b border-white/15 p-5 sm:p-6 lg:col-span-2 lg:border-b-0 lg:border-r lg:border-white/10">
        <div class="mb-5 flex flex-wrap items-end justify-between gap-3">
          <div>
            <p class="font-sora text-[15px] font-semibold text-white">Revenue Trend</p>
            <p class="sg-mono mt-1 text-[11px] text-white/55">last <span data-range-label>30 days</span></p>
          </div>
          <div class="flex items-center gap-4">
            <span class="flex items-center gap-1.5 sg-mono text-[11px] text-white/70">
              <span class="inline-block h-2 w-2 rounded-full bg-gradient-to-r from-fuchsia-400 to-indigo-400"></span>Revenue
            </span>
            <span class="flex items-center gap-1.5 sg-mono text-[11px] text-white/70">
              <span class="inline-block h-2 w-2 rounded-full bg-white/40"></span>Prev period
            </span>
          </div>
        </div>
        <div class="relative">
          <svg data-chart viewBox="0 0 640 240" preserveAspectRatio="none" class="h-56 w-full sm:h-64" role="img" aria-label="Revenue trend chart"></svg>
          <div class="mt-2 flex items-center justify-between sg-mono text-[10px] text-white/45" data-chart-axis></div>
        </div>
      </div>

      <!-- Activity feed -->
      <div class="p-5 sm:p-6">
        <div class="mb-4 flex items-center justify-between">
          <p class="font-sora text-[15px] font-semibold text-white">Recent Activity</p>
          <button type="button" class="sg-mono text-[11px] text-white/55 transition-colors hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60">All</button>
        </div>
        <ul class="space-y-3" data-activity>
          <li class="flex gap-3 rounded-xl border border-white/15 bg-white/5 p-3 backdrop-blur transition-colors hover:bg-white/10">
            <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/20 bg-gradient-to-br from-fuchsia-500/40 to-indigo-500/40 text-white backdrop-blur">
              <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
            </span>
            <div class="min-w-0 flex-1">
              <p class="font-sora text-[13px] font-medium text-white">New customer upgrade</p>
              <p class="sg-mono mt-0.5 text-[11px] text-white/50">acme-co · pro · 2m</p>
            </div>
          </li>
          <li class="flex gap-3 rounded-xl border border-white/15 bg-white/5 p-3 backdrop-blur transition-colors hover:bg-white/10">
            <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/20 bg-gradient-to-br from-cyan-400/40 to-indigo-500/40 text-white backdrop-blur">
              <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6" /></svg>
            </span>
            <div class="min-w-0 flex-1">
              <p class="font-sora text-[13px] font-medium text-white">Payout processed</p>
              <p class="sg-mono mt-0.5 text-[11px] text-white/50">stripe · $4,820 · 38m</p>
            </div>
          </li>
          <li class="flex gap-3 rounded-xl border border-white/15 bg-white/5 p-3 backdrop-blur transition-colors hover:bg-white/10">
            <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/20 bg-gradient-to-br from-fuchsia-500/40 to-purple-500/40 text-white backdrop-blur">
              <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M6 9l6 6 6-6" /></svg>
            </span>
            <div class="min-w-0 flex-1">
              <p class="font-sora text-[13px] font-medium text-white">Churn alert resolved</p>
              <p class="sg-mono mt-0.5 text-[11px] text-white/50">quark.io · 1h</p>
            </div>
          </li>
          <li class="flex gap-3 rounded-xl border border-white/15 bg-white/5 p-3 backdrop-blur transition-colors hover:bg-white/10">
            <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/20 bg-gradient-to-br from-cyan-400/40 to-fuchsia-500/40 text-white backdrop-blur">
              <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><circle cx="12" cy="12" r="3" /><path d="M12 2v3M12 19v3M2 12h3M19 12h3" /></svg>
            </span>
            <div class="min-w-0 flex-1">
              <p class="font-sora text-[13px] font-medium text-white">New trial signup</p>
              <p class="sg-mono mt-0.5 text-[11px] text-white/50">loop-labs · 3h</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>

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

      var datasets = {
        7: {
          labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          current: [42, 55, 48, 71, 66, 80, 95],
          previous: [38, 47, 52, 60, 58, 70, 82],
          kpis: {
            revenue: { value: '$11,420', delta: '▲ +9.2%', tone: 'emerald' },
            users: { value: '4,820', delta: '▲ +6.4%', tone: 'emerald' },
            mrr: { value: '$12,640', delta: '▲ +5.7%', tone: 'emerald' },
            churn: { value: '2.1%', delta: '▼ -0.3pp', tone: 'fuchsia' }
          }
        },
        30: {
          labels: ['W1', 'W2', 'W3', 'W4'],
          current: [320, 410, 380, 510],
          previous: [280, 360, 340, 460],
          kpis: {
            revenue: { value: '$48,210', delta: '▲ +12.4%', tone: 'emerald' },
            users: { value: '18,402', delta: '▲ +8.1%', tone: 'emerald' },
            mrr: { value: '$12,640', delta: '▲ +5.7%', tone: 'emerald' },
            churn: { value: '2.1%', delta: '▼ -0.3pp', tone: 'fuchsia' }
          }
        },
        90: {
          labels: ['M1', 'M2', 'M3'],
          current: [1480, 1720, 1610],
          previous: [1260, 1520, 1450],
          kpis: {
            revenue: { value: '$142,080', delta: '▲ +18.6%', tone: 'emerald' },
            users: { value: '52,140', delta: '▲ +14.2%', tone: 'emerald' },
            mrr: { value: '$13,920', delta: '▲ +9.3%', tone: 'emerald' },
            churn: { value: '1.9%', delta: '▼ -0.4pp', tone: 'fuchsia' }
          }
        }
      };

      var chipClass = {
        emerald: 'inline-flex items-center gap-1 rounded-full border border-emerald-300/30 bg-emerald-400/15 px-1.5 py-0.5 text-emerald-200',
        fuchsia: 'inline-flex items-center gap-1 rounded-full border border-fuchsia-300/30 bg-fuchsia-400/15 px-1.5 py-0.5 text-fuchsia-100'
      };

      var chart = root.querySelector('[data-chart]');
      var axis = root.querySelector('[data-chart-axis]');
      var rangeLabel = root.querySelector('[data-range-label]');
      var buttons = root.querySelectorAll('.sg-range');

      function smoothPath(pts) {
        if (pts.length < 2) return '';
        var d = 'M ' + pts[0].x.toFixed(1) + ' ' + pts[0].y.toFixed(1);
        for (var i = 1; i < pts.length; i++) {
          var p0 = pts[i - 1], p1 = pts[i];
          var cx = (p0.x + p1.x) / 2;
          d += ' C ' + cx.toFixed(1) + ' ' + p0.y.toFixed(1) + ' ' + cx.toFixed(1) + ' ' + p1.y.toFixed(1) + ' ' + p1.x.toFixed(1) + ' ' + p1.y.toFixed(1);
        }
        return d;
      }

      function render(range) {
        var d = datasets[range];
        if (!d) return;

        ['revenue', 'users', 'mrr', 'churn'].forEach(function (key) {
          var card = root.querySelector('[data-kpi="' + key + '"]');
          if (!card) return;
          var k = d.kpis[key];
          var valEl = card.querySelector('[data-kpi-value]');
          var dEl = card.querySelector('[data-kpi-delta]');
          if (valEl) valEl.textContent = k.value;
          if (dEl) dEl.innerHTML = '<span class="' + chipClass[k.tone] + '">' + k.delta + '</span>';
        });

        if (rangeLabel) rangeLabel.textContent = range + ' days';

        var W = 640, H = 240, padB = 22, padT = 14, padX = 18;
        var n = d.current.length;
        var max = Math.max.apply(null, d.current.concat(d.previous)) * 1.15;
        var innerW = W - padX * 2;
        var innerH = H - padT - padB;
        var xAt = function (i) { return padX + (n === 1 ? innerW / 2 : (innerW * i) / (n - 1)); };
        var yAt = function (v) { return padT + innerH - (v / max) * innerH; };

        var curPts = d.current.map(function (v, i) { return { x: xAt(i), y: yAt(v) }; });
        var prevPts = d.previous.map(function (v, i) { return { x: xAt(i), y: yAt(v) }; });
        var curPath = smoothPath(curPts);
        var prevPath = smoothPath(prevPts);
        var areaPath = curPath + ' L ' + xAt(n - 1).toFixed(1) + ' ' + (H - padB) + ' L ' + xAt(0).toFixed(1) + ' ' + (H - padB) + ' Z';

        var svg = '';
        for (var g = 0; g <= 4; g++) {
          var gy = padT + innerH * (g / 4);
          svg += '<line x1="' + padX + '" y1="' + gy.toFixed(1) + '" x2="' + (W - padX) + '" y2="' + gy.toFixed(1) + '" stroke="rgba(255,255,255,0.08)" stroke-width="1"/>';
        }
        svg += '<defs><linearGradient id="sgArea" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#d946ef" stop-opacity="0.5"/><stop offset="100%" stop-color="#6366f1" stop-opacity="0"/></linearGradient><linearGradient id="sgLine" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stop-color="#e879f9"/><stop offset="100%" stop-color="#818cf8"/></linearGradient></defs>';
        svg += '<path d="' + prevPath + '" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="1.5" stroke-dasharray="3 3"/>';
        svg += '<path d="' + areaPath + '" fill="url(#sgArea)"/>';
        svg += '<path d="' + curPath + '" fill="none" stroke="url(#sgLine)" stroke-width="2.5" stroke-linecap="round"/>';
        curPts.forEach(function (p) {
          svg += '<circle cx="' + p.x.toFixed(1) + '" cy="' + p.y.toFixed(1) + '" r="3.5" fill="rgba(217,70,239,0.9)" stroke="#fff" stroke-width="1.5"/>';
        });
        svg += '<line x1="' + padX + '" y1="' + (H - padB) + '" x2="' + (W - padX) + '" y2="' + (H - padB) + '" stroke="rgba(255,255,255,0.12)" stroke-width="1"/>';
        chart.innerHTML = svg;

        if (axis) axis.innerHTML = d.labels.map(function (l) { return '<span>' + l + '</span>'; }).join('');

        buttons.forEach(function (b) {
          var active = b.dataset.range === String(range);
          b.classList.toggle('bg-gradient-to-r', active);
          b.classList.toggle('from-fuchsia-500', active);
          b.classList.toggle('to-indigo-500', active);
          b.classList.toggle('text-white', active);
          b.classList.toggle('text-white/70', !active);
          b.classList.toggle('shadow', active);
          if (active) b.setAttribute('aria-pressed', 'true'); else b.removeAttribute('aria-pressed');
        });
      }

      buttons.forEach(function (b) {
        b.addEventListener('click', function () { render(parseInt(b.dataset.range, 10)); });
      });

      render(30);
    })();
  </script>
</div>
287 lines UTF-8 · LF · Spaces: 2

AI-ready

Available to your agent.

This section is reachable through the DevSnips CLI, MCP server and Skills integrations — one registry, one resource path.

Resource path

devsnips://sections/app-ui/dashboard-overview/sharp-glassmorphism

Continue browsing

View all