
Building an Apple-Style Liquid Glass UI for a Business Dashboard
#CSS #Frontend #Design #Hackathon #WebDevelopment Sentinel - Silent Loss Detector --) Find the money your business is quietly losing.
The brief I gave myself
When we started Sentinel, the team agreed on one design rule that we didn't allow ourselves to compromise on:
It should look like software a business owner would actually pay for.
Not "hackathon project" software. Not "AI demo" software. Not another purple gradient SaaS dashboard with rounded corners and stock illustrations. Something that feels like it was made by a company that cares.
That's a hard target. Most business dashboards look like business dashboards because that's what people expect. We wanted to break that expectation without breaking usability, and without shipping a UI that looked like it was trying too hard.
Sentinel ended up as a single HTML file. Zero build step. Zero dependencies. Zero frameworks. Just semantic markup, modern CSS, and vanilla JavaScript. The entire design system lives in a
<style> block at the top of the file, and everything else composes from it.This post is about how that file was built — the specific techniques, the design decisions, and the things that fought back.
The philosophy: three rules we never broke
Before writing a line of CSS, we set three rules. They became the filter for every decision that followed.
Rule 1: Animate state changes, not existence. When something appears, changes, or disappears, animate it. When nothing is happening, don't. This one rule cut 60% of the animations we initially wanted to write.
Rule 2: Every visual effect must have a reason. The count-up animation on the KPI numbers isn't decorative — it says "this number was just calculated for you." The drawer slides from the right because that communicates "detail view, dismissible." Motion is language, not decoration.
Rule 3: Minimal content, maximal craft. The information is minimal. The typography, spacing, blur, and motion are anything but. Restraint applies to what you say, not to how carefully you say it.
Those three rules anchored everything.
The Liquid Glass recipe
"Glass-morphism" in 2026 usually means
backdrop-filter: blur(20px) plus a semi-transparent white border. It's everywhere and it's honestly a bit tired.What we aimed for was closer to Apple's Liquid Glass — the design language refined across iOS 17, macOS Sonoma, and visionOS. The difference is in the layers.
Here's the base recipe we used for every glass surface in Sentinel:
CSS:
.glass{ position:relative; isolation:isolate; overflow:hidden; background:linear-gradient(135deg,var(--glass-strong),var(--glass)); backdrop-filter:blur(28px) saturate(180%); -webkit-backdrop-filter:blur(28px) saturate(180%); border:1px solid var(--glass-brd); border-radius:var(--r-lg); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi), inset 0 -1px 0 rgba(255,255,255,.03);}The three shadow layers each do a specific job:
-
var(--shadow)— the outer drop shadow. This is what gives the surface physical weight. Without it, the element floats without gravity.
-
inset 0 1px 0 var(--glass-hi)— a bright top edge. This is the single most important trick. It's what makes glass look lit instead of just translucent. Every physical piece of glass has a highlight along its top edge from the light source above.
-
inset 0 -1px 0 rgba(255,255,255,.03)— a faint bottom edge. It sells the sense of physical thickness.
And the
saturate(180%) is the secret sauce on the blur. Plain blur() produces a greyscale haze. saturate(180%) on top makes the blurred content retain its colour, which is exactly what real frosted glass does.The cursor-following glow
Each glass surface has one more trick: a radial highlight that follows the cursor. It's not a mouse trail — it's a subtle lens flare that responds to where you're pointing.
CSS:
.glass::before{ content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:-1; background:radial-gradient(520px circle at var(--mx,50%) var(--my,0%), rgba(255,255,255,.13),transparent 46%); opacity:0; transition:opacity .5s var(--ease);}.glass:hover::before{opacity:1}And the JavaScript that drives it, at the document level:
JS:
document.addEventListener('pointermove', e => { const g = e.target.closest('.glass'); if (!g) return; const r = g.getBoundingClientRect(); g.style.setProperty('--mx', (e.clientX - r.left) + 'px'); g.style.setProperty('--my', (e.clientY - r.top) + 'px');}, { passive: true });Two important details:
- The listener uses
{ passive: true }so it never blocks scroll.
- It updates two CSS custom properties and nothing else. The browser handles the rest. No layout thrash, no repaint of anything except the gradient. It's essentially free.
The result is subtle and physical — the highlight feels like it's inside the glass, not painted on top.
Dual themes done right
Most sites implement dark/light as an inverted palette. Sentinel does something more considered: the two themes have different physical weights.
Dark mode glass sits on top of a very dark background (
#050508 ), so the glass can be light — rgba(255,255,255,.05) . It reads as a subtle lift off the page.Light mode glass sits on
#eceef5 (a soft grey). To keep the same visual weight, the glass has to be much more opaque — rgba(255,255,255,.52) at the low end, and rgba(255,255,255,.78) on the "strong" variant. Otherwise it disappears.Every glass component uses
var(--glass) and var(--glass-brd) — and the theme switch is a single attribute flip on <html> :CSS:
[data-theme="dark"]{ --bg:#050508; --glass:rgba(255,255,255,.05); --glass-strong:rgba(255,255,255,.095); --glass-brd:rgba(255,255,255,.13); --glass-hi:rgba(255,255,255,.26); --shadow:0 24px 60px -24px rgba(0,0,0,.75),0 2px 10px rgba(0,0,0,.3);}[data-theme="light"]{ --bg:#eceef5; --glass:rgba(255,255,255,.52); --glass-strong:rgba(255,255,255,.78); --glass-brd:rgba(255,255,255,.9); --glass-hi:rgba(255,255,255,1); --shadow:0 22px 50px -22px rgba(52,66,120,.32),0 1px 3px rgba(52,66,120,.08);}Every glass surface retunes automatically. Even the shadows — which need to be far subtler in light mode to feel right. A dark, heavy shadow on a bright background looks like a UI bug. A soft, blue-tinted shadow looks like sunlight.
The circular theme reveal
The theme switch itself is a small piece of theatre. When you toggle, the new theme doesn't fade in — it opens up from the click point using the View Transitions API.
JS:
function setTheme(t, ev){ const apply = () => { document.documentElement.dataset.theme = t; localStorage.setItem('sentinel.theme', t); syncThemeIcon(); };
if (!document.startViewTransition || reduce) { apply(); return; }
const x = ev?.clientX ?? innerWidth - 40; const y = ev?.clientY ?? 30; const r = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y));
const vt = document.startViewTransition(apply); vt.ready.then(() => document.documentElement.animate( { clipPath: [`circle(0px at ${x}px ${y}px)`, `circle(${r}px at ${x}px ${y}px)`] }, { duration: 700, easing: 'cubic-bezier(.22,1,.36,1)', pseudoElement: '::view-transition-new(root)' } ) ).catch(() => {});}Two details worth noting:
- The radius calculation.
Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y))computes the distance from the click point to the furthest corner of the viewport. That way the circle always covers the entire screen, no matter where you click.
- The
.catch(() => {})on the animation. If the user interacts mid-transition — or the browser aborts it for any reason — we silently ignore the error. View Transitions are a nice-to-have, never a hard requirement.
The whole thing falls back to an instant theme switch if
document.startViewTransition doesn't exist. Zero risk, high reward.
Motion that earns its keep
Motion in a business tool is dangerous. Too much and it feels unserious. Too little and it feels dead.
Scroll-reveal at the element level
The first time an element scrolls into view, it fades and rises 22px over 900ms. That's it. No bounce, no rotation, no stagger of 15 different properties.
CSS:
.rv{ opacity:0; transform:translateY(22px); transition:opacity .9s var(--ease),transform 1s var(--ease); transition-delay:var(--d,0ms);}.rv.on{opacity:1;transform:none}The
--d custom property lets us stagger sibling reveals by a few dozen milliseconds — set inline as style="--d:90ms" on the element. Everything else is one class flip when the intersection observer fires.We deliberately use one observer for the whole page, shared across views, and we
unobserve each element after it fires. Once revealed, an element never gets re-observed. That's how you keep the transition budget cheap.Count-up on the KPI numbers
The KPI numbers don't just appear — they count up from zero to their target over 1.1 seconds, using a
requestAnimationFrame loop and an exponential ease:JS:
function countUp(el, to, fmt, dur = 1100){ if (reduce || !isFinite(to) || to === 0) { el.textContent = fmtV(to, fmt); return; } const t0 = performance.now(); const f = t => { const p = Math.min(1, (t - t0) / dur); const e = p >= 1 ? 1 : 1 - Math.pow(2, -10 * p); el.textContent = fmtV(to * e, fmt); if (p < 1) requestAnimationFrame(f); }; requestAnimationFrame(f);}The ease is
1 - 2^(-10p) . It starts fast, decelerates smoothly, and lands exactly on target. Compare to a linear count — that feels mechanical. Compare to a spring — that feels like a slot machine. This one feels like the number was just calculated for you.The one that matters most: it respects
prefers-reduced-motion . If the user has that set at the OS level, the number appears instantly.The drawer that slides like paper
The finding detail drawer translates in from the right using:
CSS:
.dr-card{ transform:translateX(calc(100% + 30px)); transition:transform .75s cubic-bezier(.22,1,.36,1);}.drawer.open .dr-card{transform:none}That
cubic-bezier(.22,1,.36,1) is Apple's standard curve — the same one they use for sheets in iOS and macOS. It starts with a slight overshoot feel (it's technically ease-out, not ease-elastic), lands smoothly, and never bounces.The transition duration is 750ms. That feels slightly long at first, but it's actually correct for a full-height panel that occupies the entire right side of the viewport. Shorter durations make the panel feel twitchy.
The router that doesn't feel like a router
Sentinel is a single-page app with four views: Home, Dashboard, Data, Assistant. The routing is hash-based (
#/dashboard ), and the transition between views is what makes it feel native.CSS:
.view{opacity:0;transform:translateY(14px)}.view[hidden]{display:none}.view.in{opacity:1;transform:none; transition:opacity .6s var(--ease),transform .8s var(--ease)}.view.out{opacity:0;transform:translateY(-8px); transition:opacity .22s var(--ease-in),transform .22s var(--ease-in)}The in transition takes 600–800ms because it's the arrival. The out transition takes only 220ms because it's the departure — you don't want the old content lingering.
The JavaScript sequences it manually:
JS:
function show(v){ if (v === cur) return; const next = $('#view-' + v), prev = cur ? $('#view-' + cur) : null; cur = v;
$$('#tabs a').forEach(a => a.classList.toggle('on', a.dataset.v === v)); moveInd();
const enter = () => { VIEWS.forEach(x => { if (x !== v) $('#view-' + x).hidden = true; }); next.hidden = false; next.classList.remove('in', 'out'); window.scrollTo(0, 0); void next.offsetWidth; // force reflow next.classList.add('in'); onEnter(v); };
if (prev && !reduce){ prev.classList.add('out'); setTimeout(() => { prev.classList.remove('out', 'in'); enter(); }, 220); } else enter();}Three details worth calling out:
-
void next.offsetWidth— this forces a synchronous reflow, which is what guarantees the.inclass transition will actually fire. Without it, browsers sometimes skip the transition when adding a class to an element that was just made visible.
-
window.scrollTo(0, 0)— happens before the enter animation. Scroll position resets instantly and the new view animates in from the top. It feels correct.
-
onEnter(v)is called after the animation starts, not before. The view renders its content while it's already sliding in. Combined with the reveal delays on children, this creates the staggered "assemble" effect.
The segmented control with a sliding thumb
Every multi-option selector in Sentinel uses the same pattern: a pill-shaped container with a sliding background behind the active button.
CSS:
.ind,.thumb{ position:absolute; top:4px;bottom:4px;left:0;width:0; border-radius:999px; background:var(--glass-strong); border:1px solid var(--glass-brd); box-shadow:0 4px 14px -6px rgba(0,0,0,.35),inset 0 1px 0 var(--glass-hi); transition:transform .6s var(--ease),width .6s var(--ease);}The JS just measures the active button and animates the thumb into place:
JS:
function segMove(seg){ const b = $('button.on', seg), t = $('.thumb', seg); if (!b || !seg.offsetWidth) return; t.style.width = b.offsetWidth + 'px'; t.style.transform = 'translateX(' + b.offsetLeft + 'px)';}The key trick: on the first paint, disable the transition. Otherwise the thumb visibly slides from
width: 0 to its actual width on page load, which looks broken. We apply .no-t (which sets transition: none ) for the first 80ms:CSS:
.ind.no-t{transition:none}JS:
setTimeout(() => { $('#tabs .ind').classList.remove('no-t'); }, 80);Small detail. Massive difference in how polished the first second of the app feels.
The chart — hand-drawn SVG, no library
Sentinel has a stockout timeline that shows weekly sales, shaded stockout periods, and delivery markers. It's the single most information-dense visual in the app.
We didn't use Chart.js, D3, or Recharts. The whole thing is 60 lines of JavaScript that generate an SVG string.
JS:
const W = 720, H = 240;const weeks = 26, days = weeks * 7;const wk = Array(weeks).fill(0);
// Bucket sales into weeksfor (const s of DB.sales){ if (s.productId !== pid) continue; const o = diff(s.date, T); if (o < 0 || o >= days) continue; wk[weeks - 1 - Math.floor(o / 7)] += +s.qty || 0;}
// Scale barsconst mx = Math.max(1, ...wk) * 1.12;const bw = pw / weeks;const Y = v => pt + ph - (v / mx) * ph;
// Barswk.forEach((v, i) => { const h = Math.max(v > 0 ? 2 : 0, ph - (Y(v) - pt)); g += `<rect class="bar" style="--i:${i}" x="${pl + bw * i + bw * .16}" y="${pt + ph - h}" width="${bw * .68}" height="${h}" rx="4" fill="url(#bg1)"/>`;});Why hand-draw it? Three reasons:
- Weight. No 40KB chart library for a single chart.
- Control. Every pixel is ours. We can style bars, bands, and dots with the same CSS custom properties that drive the rest of the app.
- Animation. Each bar has
animation-delay: calc(var(--i) * 24ms), so 26 bars cascade in over 600ms. You cannot do this easily with most chart libraries — you'd fight their render loop.
The bars grow from the baseline with a
scaleY transform (not a height animation), which is GPU-composited and costs nothing:CSS:
.bar{ transform-box:fill-box; transform-origin:center bottom; animation:grow-y .9s var(--ease) both; animation-delay:calc(var(--i)*24ms);}@keyframes grow-y{from{transform:scaleY(0)}}The stockout bands are SVG rectangles with a dashed red border. The delivery markers are SVG circles coloured by lateness — green for on-time, amber for late. The whole chart is ~4KB of generated markup, no dependency, and it renders at 60fps on a mid-range laptop.
Accessibility was not an afterthought
Three things we built in from the start:
1.
prefers-reduced-motion at the top level.CSS:
@media (prefers-reduced-motion: reduce){ *,*::before,*::after{ animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; transition-delay:0ms!important; }}One block. Everything respects the OS setting. And on the JS side, there's a
reduce constant that mirrors the media query result — used to short-circuit scroll reveals, count-ups, and the View Transition.2. Focus-visible everywhere.
CSS:
:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:10px;}Keyboard users get a clean, branded focus ring. Mouse users never see it.
3. Semantic HTML with ARIA where it matters. The drawer is
role="dialog" aria-modal="true" , the toast is role="status" , icons are aria-hidden="true" , and interactive rows are keyboard-focusable buttons with aria-label . These aren't dramatic, but they're the difference between "a nice prototype" and "something we'd actually ship."
What fought back
Three things nearly broke the design.
1. Performance of
backdrop-filter at scale. A page with 20 glass surfaces scrolling at 60fps is fine on an M1 Mac and a slideshow on a 5-year-old Windows laptop. We mitigated this by:- Limiting the blur to 28px (40px was 40% slower for zero visual gain at typical viewport sizes).
- Never nesting glass inside glass more than one level deep. Nested
backdrop-filteris genuinely expensive.
- Using
will-change: transformonly on the animated background orbs — nothing else. Over-applyingwill-changeactually hurts performance because the browser keeps too many layers alive.
2. The light mode contrast problem. Our first light mode looked washed out. Every surface was too pale, and the whole UI read as if the screen brightness was set wrong. The fix was counterintuitive: make the light glass more opaque, not less. At 72–78% opacity with a strong inner highlight, light mode feels just as defined as dark mode — arguably more so, because the inner highlight is
rgba(255,255,255,1) on a bright background.3. The "everything animates" trap. Our first prototype had animation on every hover, every focus, every render. It felt like a toy. The rule that saved us was Rule 1: animate state changes, not existence. Once we stopped animating things that weren't changing, the app immediately felt more serious.
The design system in numbers
- 28px — the blur radius on every glass surface
- 180% — the saturation multiplier on every blur
- 700ms — the View Transition duration for the theme reveal
- 60ms — the stagger delay between cascading entrance elements
- 24ms — the stagger delay between chart bars
- 2 — the number of distinct motion curves used (ease-out and ease-in)
- 1 — the number of lines needed to respect
prefers-reduced-motion
- 0 — the number of frontend dependencies in the whole app
What we learned
1. Minimal isn't the same as empty. We could have made Sentinel stark — just black and white and text. Instead we layered depth, texture, and motion while keeping the information minimal. Restraint applies to content, not to craft.
2. Motion is a language. Every transition communicates something. The drawer sliding from the right says "detail view, dismissible." The count-up says "this number was just computed." The pulsing critical dot says "look here." Once you think of motion as language, you stop animating for fun and start animating for meaning.
3. The theme switch is a design decision, not a checkbox. Getting dark and light both feeling right is 3× the work of getting one right. But it's worth it. Every user has a preference, and respecting it costs you nothing in the long run.
4.
backdrop-filter is the most expensive property in CSS. Use it deliberately. One blur on a container is fine. Ten blurs on nested cards is a browser tax you can't afford.5. Apple's design language is a set of principles, not a stylesheet. We copied their blur recipe. We borrowed their motion curves. But the reason it works isn't the specific numbers — it's the discipline behind them. The restraint. The consistency. The respect for the user's attention.
That's the part worth stealing.
Try it yourself
- Live demo: [ https://main.dhje9buvb95c7.amplifyapp.com ]
- Source: [ https://github.com/manishpshetty3648/Sentinel ]
Try switching themes in the top right — watch the circular reveal. Hover over a glass card and move your cursor — the highlight follows. Open a finding to see the drawer slide in. Click a filter to see the segmented control's thumb glide.
Every one of those moments is a small decision. Together they're the reason the app feels like it was made by a company that cares.
Built by Team NxtOps for the Bharat Builds Tour "First Commit" hackathon, in collaboration with WeMakeDevs and AWS.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article