№ 006

Tide Nav

A tab bar filled with water — switching tabs sends a wave across the surface.

Version
1.0.0
Download
8 KB · 3 files
Added
Oct 26, 2026
Built with
HTML, CSS, JS
Needs
Nothing
Tags
tab bar, water, simulation

Usage

Copy tide-nav.css and tide-nav.js (and assets/, if there is one) into your project, then:

  new TideNav(element, { tabs: [{ label, icon }], active: 0, onChange(tab, index) {} })
`icon` is a key of TideNav.icons or a raw SVG string.

Source

/* Tide nav — a glass capsule filled with live water; the active tab rides the surface as a droplet. */

.td {
  --td-deep: #0f4c5c;
  --td-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --td-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  width: min(calc(100vw - 32px), 356px);
  height: 76px;
  animation: td-rise 0.9s var(--td-smooth) both;
  -webkit-tap-highlight-color: transparent;
}

@keyframes td-rise {
  from { opacity: 0; transform: translateY(30px) scale(0.94); }
}

.td-filters {
  position: absolute;
  width: 0;
  height: 0;
}

.td-capsule {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18));
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow:
    0 1px 1px rgba(20, 80, 100, 0.1),
    0 8px 14px -4px rgba(20, 110, 140, 0.18),
    0 26px 36px -14px rgba(20, 130, 165, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 6px rgba(20, 120, 150, 0.25),
    inset 0 0 22px rgba(255, 255, 255, 0.35);
  touch-action: pan-y;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* bevelled rim */
.td-capsule::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  padding: 1.3px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, #fff 0%, rgba(255, 255, 255, 0.15) 30%, rgba(255, 255, 255, 0.1) 65%, rgba(255, 255, 255, 0.95) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* curved window reflection */
.td-capsule::after {
  content: "";
  position: absolute;
  z-index: 5;
  left: 6%;
  right: 38%;
  top: 4px;
  height: 17px;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.02));
  filter: blur(0.4px);
}

.td-clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

/* underwater icons, wobbled by a turbulence filter (set inline per instance) */
.td-tabs {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
}

.td-tab {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 14px 0 0;
  border: 0;
  outline: none;
  background: none;
  color: rgba(6, 44, 58, 0.95);
  cursor: pointer;
  transition: color 0.3s, opacity 0.3s, transform 0.5s var(--td-spring);
}

.td-tab svg {
  width: 25px;
  height: 25px;
  transition: transform 0.5s var(--td-spring), opacity 0.25s;
}

.td-tab.is-active svg { opacity: 0; transform: translateY(-14px) scale(0.6); }
.td-tab:active svg { transform: scale(0.85); }
.td-tab:focus-visible { border-radius: 999px; box-shadow: inset 0 0 0 2px rgba(15, 76, 92, 0.9); }

.td-water {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* the droplet */
.td-drop {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.98) 0 6%, rgba(255, 255, 255, 0.3) 20%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 50% 118%, rgba(70, 215, 230, 0.75), rgba(70, 215, 230, 0) 62%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.06) 72%);
  -webkit-backdrop-filter: blur(2.5px) saturate(190%) brightness(1.1);
  backdrop-filter: blur(2.5px) saturate(190%) brightness(1.1);
  box-shadow:
    inset 0 0 0 1.3px rgba(255, 255, 255, 0.75),
    inset 0 -9px 14px rgba(0, 130, 170, 0.32),
    inset 0 7px 10px rgba(255, 255, 255, 0.6),
    0 12px 18px -7px rgba(10, 110, 150, 0.55);
}

/* caustic crescent */
.td-drop::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 14%;
  bottom: 7%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(190, 255, 255, 0.65), transparent);
  filter: blur(1px);
  transform: rotate(-12deg);
}

.td-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--td-deep);
}

.td-glyph svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.9;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7));
  animation: td-glyph-in 0.5s var(--td-spring);
}

@keyframes td-glyph-in {
  from { opacity: 0; transform: scale(0.4) translateY(10px); }
}

@media (prefers-reduced-motion: reduce) {
  .td, .td-glyph svg { animation-duration: 0.01ms !important; }
}