Code And Chill

Crest — Liquid Tab Bar (Animated Bottom Navigation)

Navigation 2

About

A bottom navigation bar whose active tab is marked by liquid: it runs along the bar, pinches off a drop and fills the icon. Keyboard and reduced-motion ready. More skins and real page links in the full version: codeandchill.store/components/crest?utm_source=21st

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Crest — Liquid Tab Bar (Animated Bottom Navigation) to your project and fits it to your theme.

Code

How Crest — Liquid Tab Bar (Animated Bottom Navigation) is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useEffect, useState } from "react";
import { useReducedMotion } from "motion/react";
import CrestTabBar, { DEFAULT_ITEMS } from "@/components/ui/crest-liquid-tab-bar";

const settings = {
  defaultIndex: 0,
  lightAccent: "#6936ea",
  darkAccent: "#b79bff",
};

const LINES = [
  "Everything, in one place.",
  "Three unread. All of them polite.",
  "Forty‑two documents, nothing misfiled.",
  "Quiet since Tuesday.",
  "You, as the system sees you.",
];

/* The original's skins: ink (the dark skin its video wears, opened first) and lilac. */
const LOOK = {
  light: { wash: "#e6d9fb", wash2: "#c6b0f4", ink: "#1c1033", ink2: "#3d2a60" },
  dark: { wash: "#0a0813", wash2: "#120e24", ink: "#f3eeff", ink2: "#b7abd8" },
} as const;

const EASE_OUT = "cubic-bezier(.22, .84, .3, 1)";
const EASE_IN = "cubic-bezier(.55, 0, .78, .2)";

export default function Demo(props: Partial<typeof settings> = {}) {
  const s = { ...settings, ...props };
  const reduce = useReducedMotion();
  const [index, setIndex] = useState(s.defaultIndex);
  // When the Controls panel changes the starting tab, the bar remounts; follow it.
  const [startedAt, setStartedAt] = useState(s.defaultIndex);
  if (startedAt !== s.defaultIndex) {
    setStartedAt(s.defaultIndex);
    setIndex(s.defaultIndex);
  }
  // Crest opens in its ink skin — the dark look of its showcase video — then
  // follows the page's `dark` class only when it changes.
  const [dark, setDark] = useState(true);
  useEffect(() => {
    const html = document.documentElement;
    let last = html.classList.contains("dark");
    const mo = new MutationObserver(() => {
      const now = html.classList.contains("dark");
      if (now !== last) {
        last = now;
        setDark(now);
      }
    });
    mo.observe(html, { attributes: true, attributeFilter: ["class"] });
    return () => mo.disconnect();
  }, []);

  const look = dark ? LOOK.dark : LOOK.light;
  const accent = dark ? s.darkAccent : s.lightAccent;

  return (
    <div
      className="flex min-h-[100dvh] w-full flex-col items-center justify-center gap-7 overflow-hidden px-4 py-12"
      style={{
        background: `radial-gradient(120% 80% at 50% 8%, ${look.wash} 0%, ${look.wash2} 100%)`,
        color: look.ink,
        fontFamily: 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',
      }}
    >
      {/* The screen above the bar. Out fast, in slow and late: a symmetrical
          cross-fade leaves both lines legible at once and reads as a ghost. */}
      <div className="grid w-full max-w-md text-center" aria-live="polite">
        {DEFAULT_ITEMS.map((item, i) => {
          const on = i === index;
          return (
            <section
              key={item.label}
              aria-hidden={!on}
              style={{
                gridArea: "1 / 1",
                opacity: on ? 1 : 0,
                visibility: on ? "visible" : "hidden",
                transform: on || reduce ? "none" : "translate3d(0, 8px, 0)",
                transition: reduce
                  ? "none"
                  : on
                    ? `opacity .3s ${EASE_OUT} .114s, transform .3s ${EASE_OUT} .114s, visibility 0s linear 0s`
                    : `opacity .135s ${EASE_IN}, transform .135s ${EASE_IN}, visibility 0s linear .135s`,
              }}
            >
              <h2 className="m-0 text-[clamp(22px,2.6vw,30px)] font-medium tracking-[-0.02em]">{item.label}</h2>
              <p className="mt-1.5 text-[clamp(13.5px,1.4vw,16px)]" style={{ color: look.ink2 }}>
                {LINES[i]}
              </p>
            </section>
          );
        })}
      </div>

      <CrestTabBar
        key={s.defaultIndex}
        defaultIndex={s.defaultIndex}
        onChange={setIndex}
        accent={accent}
        theme={dark ? "dark" : "light"}
      />

      <p className="m-0 text-[13px]" style={{ color: look.ink2 }}>
        Pick a tab, then watch the bottom edge.
      </p>
    </div>
  );
}

Dependencies

More by Code And Chill

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    764
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    475
  • Hovira — Glassmorphism Smart Home Dashboard

    Hovira — Glassmorphism Smart Home Dashboard

    87
  • Vitra — Glass Pricing Section

    Vitra — Glass Pricing Section

    79
  • Halden — CRM Dashboard with Sales Pipeline

    Halden — CRM Dashboard with Sales Pipeline

    69
  • Kestrel — Marketing Analytics Dashboard

    Kestrel — Marketing Analytics Dashboard

    46
  • Money River — Sankey Money Flow Chart

    Money River — Sankey Money Flow Chart

    41
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    33

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    169
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    442
  • Sidebar

    Sidebar

    444
  • Tabs

    Tabs

    38
  • Pagination

    Pagination

    121
  • Sidebar

    Sidebar

    367
  • Stacked Circular Footer

    Stacked Circular Footer

    470
  • Footer

    Footer

    470