React + MotionNavigation

Tab-Leiste unten

Eine Milchglas-Leiste am unteren Rand, in der das aktive Icon leicht aufsteigt, deine Farbe annimmt und einen Punkt bekommt.

Einstellungen

Code

import { useState } from "react";
import { motion } from "framer-motion";
import { Heart, Home, Search, User } from "lucide-react";

const spring = { type: "spring" as const, stiffness: 300, damping: 30 };

const ITEMS = [
  { icon: Home, label: "Start" },
  { icon: Search, label: "Suchen" },
  { icon: Heart, label: "Favoriten" },
  { icon: User, label: "Profil" },
];

interface TabBarProps {
  color?: string;
}

export default function TabBar({ color = "#0071e3" }: TabBarProps) {
  const [active, setActive] = useState(0);

  return (
    <div className="flex rounded-[24px] bg-white/70 dark:bg-black/70 p-2 text-[#1d1d1f] dark:text-[#f5f5f7] shadow-[0_1px_2px_rgba(0,0,0,0.03),0_8px_28px_rgba(0,0,0,0.05)] backdrop-blur-[20px]">
      {ITEMS.map(({ icon: Icon, label }, i) => (
        <button
          key={label}
          type="button"
          aria-pressed={active === i}
          onClick={() => setActive(i)}
          className="relative flex w-16 flex-col items-center gap-1 py-1 text-[10px]"
        >
          <motion.span
            animate={{ y: active === i ? -3 : 0, scale: active === i ? 1.12 : 1 }}
            transition={spring}
          >
            <Icon className="h-5 w-5" style={{ color: active === i ? color : undefined }} />
          </motion.span>
          {label}
          {active === i && (
            <motion.i
              layoutId="tab-dot"
              className="absolute -bottom-0.5 h-1 w-1 rounded-full"
              style={{ backgroundColor: color }}
            />
          )}
        </button>
      ))}
    </div>
  );
}

Prompt für KI

Füg ihn in ChatGPT, Claude oder Cursor ein und der Baustein wird mit diesen Einstellungen an dein Projekt angepasst, auch ohne React.

Mehr aus Navigation

Wofür du ihn nutzen kannst

Über eine Tab-Leiste unten navigiert man in fast jeder Handy-App, weil der Daumen den unteren Rand leicht erreicht. Sie eignet sich für eine Web-App, die sich nativ anfühlen soll: einen Fitness-Tracker, eine Rezept-App, den Mitgliederbereich eines Studios oder eine Lokalzeitung auf dem Handy. Start, Suche, Favoriten und Profil decken das meiste ab.

Bleib bei drei bis fünf Tabs mit kurzen Labels. Nur Icons lassen Leute raten. Wähl eine Farbe mit gutem Kontrast zum Milchglas. Am Desktop ergibt meist eine Seitenleiste oder obere Navigation mehr Sinn als diese mobile Tab-Bar.