# Bottom tab bar

> A frosted bottom bar where the active icon rises a little, takes your color and gets a small dot under it.

- Category: [Navigation](https://library.aimran.es/components/navigation)
- Built with: React + Motion
- Live editor: https://library.aimran.es/blocks/ios-tab-bar
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

The bottom tab bar is how most phone apps are navigated, because thumbs reach the bottom of the screen easily. It works for a web app that should feel native: a fitness tracker, a recipe app, the customer area of a gym or a local news site on mobile. Four tabs like Home, Search, Favorites and Profile cover most cases.

Keep it to three to five tabs with short labels; icons alone leave people guessing. Pick a color with good contrast against the frosted background. On desktop, a sidebar or top navigation usually makes more sense than this mobile tab bar.

## Code

### React (Motion)

```tsx
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: "Home" },
  { icon: Search, label: "Search" },
  { icon: Heart, label: "Favorites" },
  { icon: User, label: "Profile" },
];

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 for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Bottom tab bar” block (Navigation) from AIMRAN Library to my project.

## What it is
A frosted bottom bar where the active icon rises a little, takes your color and gets a small dot under it.

## Chosen settings
- Color: #0071e3

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with React + TypeScript, with framer-motion for the animation and lucide-react for the icons. If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
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: "Home" },
  { icon: Search, label: "Search" },
  { icon: Heart, label: "Favorites" },
  { icon: User, label: "Profile" },
];

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>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
