Liquid Navigation Tabs

A bottom tab bar where the selection is a liquid drop. Two springs chase the tab, the front one faster, and the drop stretches between them.

Click the tabs. Jump from the first to the last to see the biggest stretch.

Download

What you can change

Change a number, save, and reload the page to see the difference.

SPRING320 / 26

Stiffness and damping of the front of the drop. Higher stiffness is snappier.

STRETCH0.6

How much slower the back of the drop is. 0.3 stretches a lot, 1 never stretches.

Add it to your site

Put it at the bottom of your app screen or in a sticky header.

  1. CSS

    Paste into your stylesheet, or inside a <style> tag in <head>.

    .app { position: relative; width: min(400px, 94vw); height: 480px; border-radius: 34px; overflow: hidden; isolation: isolate;
      background: radial-gradient(circle at 50% 30%, rgba(60,110,255,.20), transparent 60%), #0B0D13;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
    /* the colour wash under the bar, it slides to the active tab so the glass has something to pick up */
    .wash { position: absolute; left: 0; bottom: 0; width: 100%; height: 190px; pointer-events: none;
      background: radial-gradient(180px 150px at var(--wx, 50%) 100%, var(--tint, #2C6BFF), transparent 70%); opacity: .34;
      transition: background .45s ease, opacity .45s ease; }
    
    .pages { position: absolute; inset: 24px 0 96px; }
    .page { position: absolute; inset: 0; padding: 0 26px; opacity: 0; transform: translateY(26px); pointer-events: none; }
    .page.on { opacity: 1; transform: none; pointer-events: auto; transition: opacity .32s cubic-bezier(.23, 1, .32, 1), transform .32s cubic-bezier(.23, 1, .32, 1); }
    .page.out { opacity: 0; transform: translateY(-18px); transition: opacity .13s ease, transform .3s cubic-bezier(.23, 1, .32, 1); }
    
    .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: #A0AABE; }
    h2 { margin: 6px 0 16px; font-size: 27px; letter-spacing: -.02em; }
    .hero { height: 112px; border-radius: 20px; padding: 16px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-end;
      background: linear-gradient(135deg, #2C6BFF, #6FA0FF); }
    .hero small { font-size: 11px; font-weight: 600; letter-spacing: .06em; opacity: .75; }
    .hero b { font-size: 17px; }
    
    .field { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; background: rgba(255,255,255,.08); color: rgba(235,240,250,.6); font-size: 14px; }
    .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
    .grid i { height: 92px; border-radius: 16px; display: block; }
    .row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
    .row i { width: 40px; height: 40px; border-radius: 10px; flex: none; }
    .row div { flex: 1; }
    .row p { height: 7px; border-radius: 4px; background: rgba(235,240,250,.8); margin: 0 0 7px; }
    .row p + p { width: 60%; background: rgba(235,240,250,.38); }
    .row span { color: rgba(235,240,250,.45); }
    .stats { display: flex; gap: 12px; margin-top: 22px; }
    .stats div { flex: 1; padding: 12px 0; border-radius: 16px; background: rgba(255,255,255,.07); text-align: center; }
    .stats b { display: block; font-size: 20px; }
    .stats small { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: #A0AABE; }
    .me { display: flex; align-items: center; gap: 16px; }
    .me i { width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, #6FA0FF, #B07CFF); }
    .me b { display: block; font-size: 22px; }
    .me span { color: #A0AABE; font-size: 13px; }
    
    /* the floating glass bar and the capsule inside it */
    .bar, .pill {
      backdrop-filter: blur(18px) saturate(180%);
      background: rgba(150, 170, 205, 0.10);
    }
    .bar { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); display: flex; width: 304px; height: 58px; padding: 0; border-radius: 29px;
      box-shadow: 0 18px 40px -16px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.35); }
    .pill { position: absolute; left: 0; top: 8px; width: 54px; height: 42px; border-radius: 21px; pointer-events: none;
      background: rgba(10, 132, 255, .22); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 18px -8px rgba(10,132,255,.9); }
    .tab { flex: 1; border: 0; background: none; color: rgba(190,200,220,.62); display: grid; place-items: center; cursor: pointer;
      transition: color .2s ease, transform .12s cubic-bezier(.23, 1, .32, 1); }
    .tab:active { transform: scale(.9); }
    .tab[aria-selected="true"] { color: #fff; }
    .tab svg { width: 22px; height: 22px; }
    .tab:focus-visible { outline: 2px solid #5AA9FF; outline-offset: -6px; border-radius: 20px; }
    .label { position: absolute; left: 0; bottom: 18px; width: 100%; text-align: center; font-size: 12px; font-weight: 600; color: rgba(180,190,210,.75); }
    
    @media (prefers-reduced-motion: reduce) {
      .page.on, .page.out { transition: opacity .15s ease; transform: none; }
    }
  2. HTML

    Put it where the effect should appear on your page.

    <div class="app">
      <div class="wash"></div>
    
      <div class="pages">
        <section class="page on">
          <div class="eyebrow">MONDAY 15 SEPTEMBER</div>
          <h2>Today</h2>
          <div class="hero"><small>FEATURED</small><b>Liquid glass, explained</b></div>
        </section>
    
        <section class="page">
          <div class="field">🔍 Search effects</div>
          <div class="grid">
            <i style="background:linear-gradient(135deg,#38C98A,#6FE6C6)"></i>
            <i style="background:linear-gradient(135deg,#B07CFF,#F08BD0)"></i>
            <i style="background:linear-gradient(135deg,#FFB020,#FF7A45)"></i>
          </div>
          <div class="eyebrow" style="margin-top:18px">TRENDING</div>
        </section>
    
        <section class="page">
          <h2 style="margin-top:0">Library</h2>
          <div class="row"><i style="background:linear-gradient(135deg,#B07CFF,#F08BD0)"></i><div><p style="width:80%"></p><p></p></div><span>›</span></div>
          <div class="row"><i style="background:linear-gradient(135deg,#FFB020,#FF7A45)"></i><div><p style="width:70%"></p><p></p></div><span>›</span></div>
          <div class="row"><i style="background:linear-gradient(135deg,#2FC5E0,#7DE4FF)"></i><div><p style="width:60%"></p><p></p></div><span>›</span></div>
        </section>
    
        <section class="page">
          <div class="me"><i></i><div><b>@codinvisual</b><span>Design engineer</span></div></div>
          <div class="stats">
            <div><b>128</b><small>EFFECTS</small></div>
            <div><b>4.2k</b><small>STARS</small></div>
            <div><b>96</b><small>FORKS</small></div>
          </div>
        </section>
      </div>
    
      <div class="bar" role="tablist" aria-label="Sections">
        <div class="pill"></div>
        <button class="tab" role="tab" aria-selected="true" aria-label="Today">
          <svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 11.5 12 4l9 7.5V21H3z"/></svg>
        </button>
        <button class="tab" role="tab" aria-selected="false" aria-label="Search">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m16.5 16.5 4 4"/></svg>
        </button>
        <button class="tab" role="tab" aria-selected="false" aria-label="Library">
          <svg viewBox="0 0 24 24" fill="currentColor"><rect x="3" y="10" width="4" height="11" rx="2"/><rect x="10" y="4" width="4" height="17" rx="2"/><rect x="17" y="13" width="4" height="8" rx="2"/></svg>
        </button>
        <button class="tab" role="tab" aria-selected="false" aria-label="You">
          <svg viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="8" r="4"/><path d="M4 21c1.6-5 14.4-5 16 0z"/></svg>
        </button>
      </div>
      <div class="label">Today</div>
    </div>
  3. JavaScript

    Paste right before the closing </body> tag, inside <script></script>.

    const SPRING = { stiffness: 320, damping: 26 };
    const STRETCH = 0.62;
    
    const app = document.querySelector('.app');
    const bar = app.querySelector('.bar');
    const pill = app.querySelector('.pill');
    const tabs = [...app.querySelectorAll('.tab')];
    const pages = [...app.querySelectorAll('.page')];
    const label = app.querySelector('.label');
    const wash = app.querySelector('.wash');
    const NAMES = ['Today', 'Search', 'Library', 'You'];
    const TINT = ['#2C6BFF', '#38C98A', '#B07CFF', '#FF7A9A'];
    const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
    
    // one spring per end of the capsule: the tail is softer, so the capsule stretches while it travels
    const springs = () => ({
      value: 0, velocity: 0, target: 0, cfg: SPRING,
      to(x, cfg) { this.target = x; if (cfg) this.cfg = cfg; },
      jump(x) { this.value = this.target = x; this.velocity = 0; },
      step(dt) {
        const { stiffness, damping } = this.cfg;
        this.velocity += (stiffness * (this.target - this.value) - damping * this.velocity) * dt;
        this.value += this.velocity * dt;
      },
    });
    const head = springs(), tail = springs();
    
    const centerOf = tab => tab.offsetLeft + tab.offsetWidth / 2 - bar.clientWidth / 2;
    
    function select(i) {
      const tab = tabs[i];
      tabs.forEach((t, n) => t.setAttribute('aria-selected', n === i));
      pages.forEach((p, n) => {
        p.classList.toggle('on', n === i);
        p.classList.toggle('out', n !== i);
      });
      label.textContent = NAMES[i];
      wash.style.setProperty('--tint', TINT[i]);
      wash.style.setProperty('--wx', (tab.offsetLeft + tab.offsetWidth / 2) / bar.clientWidth * 100 + '%');
    
      head.to(centerOf(tab), SPRING);
      tail.to(centerOf(tab), { ...SPRING,
        stiffness: SPRING.stiffness * STRETCH });
      if (reduce) { head.jump(centerOf(tab)); tail.jump(centerOf(tab)); draw(); }
    }
    
    function draw() {
      const a = Math.min(head.value, tail.value), b = Math.max(head.value, tail.value);
      const w = 54 + (b - a);
      pill.style.width = w + 'px';
      pill.style.transform = `translateX(${bar.clientWidth / 2 + (a + b) / 2 - w / 2}px)`;
    }
    
    let last = performance.now();
    function frame(now) {
      const dt = Math.min(1 / 30, (now - last) / 1000); last = now;
      head.step(dt); tail.step(dt); draw();
      requestAnimationFrame(frame);
    }
    
    tabs.forEach((tab, i) => tab.onclick = () => select(i));
    bar.addEventListener('keydown', e => {                       // arrows move between tabs, like a real tab bar
      const i = tabs.findIndex(t => t.getAttribute('aria-selected') === 'true');
      if (e.key === 'ArrowRight') { tabs[(i + 1) % tabs.length].focus(); select((i + 1) % tabs.length); }
      if (e.key === 'ArrowLeft') { tabs[(i + tabs.length - 1) % tabs.length].focus(); select((i + tabs.length - 1) % tabs.length); }
    });
    
    addEventListener('load', () => {
      head.jump(centerOf(tabs[0])); tail.jump(centerOf(tabs[0]));
      select(0); draw();
      if (!reduce) requestAnimationFrame(frame);
    });

Connect it to your backend

Find your page switch goes here in the click handler and show the content for the selected tab.

Tilda, Webflow, WordPress

Press Copy all code at the top and paste it into one HTML block.

Tilda

Add block, Other, T123 HTML code. Paste and save. Check the published page, the editor preview does not run scripts.

Webflow

Add panel, Embed. Paste, then Save & Close. Custom code runs on the published site.

WordPress

Add block, Custom HTML. Paste and press Update.

More effects

See all
Copied