Tab bar with a sliding indicator

A bottom tab bar within thumb reach. A short line slides to the active tab and the screen fades over.

Mobile onlyNew
Install
npx finepieces add tab-bar
Or with the shadcn CLI ›
npx shadcn@latest add https://finepieces.net/r/tab-bar.json

Tap the tabs

import { TabBar } from "@/components/fine-pieces/tab-bar";

export default function Example() {
  return (
    <Phone bg="#EFE9E1">
        <TabBar
          tabs={[
            { label: "Home", icon: icon("M4 11.5 12 5l8 6.5V20h-5.5v-5h-5v5H4z"), k: "cafe-1", h: "Good morning.", p: "Your usual flat white is ready in 4 minutes." },
            { label: "Menu", icon: icon("M5 9h12v5a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5zM17 10.5h1.5a2 2 0 0 1 0 4H17M9 4.5v2M12 4v2.5"), k: "eten-1", h: "Today’s menu", p: "Banana bread, cardamom buns and a new Ethiopian filter." },
            { label: "Order", icon: icon("M5.5 8.5h13l-1 11.5h-11zM9 8.5V7a3 3 0 0 1 6 0v1.5"), k: "cafe-2", h: "Your order", p: "Flat white, oat milk. Pick up at Witte de With." },
            { label: "Account", icon: icon("M12 5.4a3.6 3.6 0 1 1 0 7.2 3.6 3.6 0 0 1 0-7.2zM5 20c1-3.6 3.8-5.4 7-5.4s6 1.8 7 5.4"), k: "cafe-3", h: "Hi, Sam.", p: "7 of 10 stamps. Three more and the next one is on us." },
          ].map((t) => ({
            label: t.label,
            icon: t.icon,
            content: (
              <div className="grid h-full grid-rows-[56%_1fr]">
                <img src={img(t.k)} alt="" className="h-full w-full object-cover" />
                <div className="px-5 py-[18px]">
                  <small className="text-[11px] font-medium text-[#8B7E72]">Kofi &amp; Co</small>
                  <h3 className="mb-2 mt-1.5 font-display text-[30px] font-bold leading-none tracking-[-.045em]">{t.h}</h3>
                  <p className="text-[13.5px] leading-[1.4] text-[#5C534B]">{t.p}</p>
                </div>
              </div>
            ),
          }))}
        />
    </Phone>
  );
}