Mobile Tab Bar

A bottom navigation bar for phones whose active-tab pill slides between tabs with a spring and whose icon bounces, with numeric or dot badges, an optional raised centre action button, docked or floating styles, blurred glass background and safe-area padding. Installs as a single component file that depends on motion, clsx and tailwind-merge.

Mobile Tab Bar
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @reactframe/mobile-tab-bar

Requires @reactframe in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { MobileTabBar } from "@/components/ui/mobile-tab-bar";<MobileTabBar />
  • Building a mobile app shell that needs a bottom tab navigation with animated active indicator and badge counts.
  • Adding a prominent primary action such as a new post or compose button between two halves of the tab bar.
  • Creating a glassmorphism-style or floating navigation bar that hovers above page content on phones.
  • Needing a tab bar that works with both client-side state (value/onValueChange) and real links (href) and respects reduced-motion preferences.

Examples

Default tab bar with uncontrolled state

Renders the built-in four tabs (Home, Search, Inbox with a badge of 3, Profile) with the floating dark theme. The first item is selected initially.

default-tab-bar-with-uncontrolled-state.tsx
import { MobileTabBar } from "@/components/ui/mobile-tab-bar";export default function Page() {  return (    <main className="min-h-screen pb-24">      <MobileTabBar defaultValue="search" />    </main>  );}

Controlled tabs with custom items and badges

Passes its own items with a numeric badge, a dot badge and link hrefs. The selected tab is kept in React state and updated through onValueChange. Requires lucide-react for the icons.

controlled-tabs-with-custom-items-and-badges.tsx
import * as React from "react";import { Home, Bell, Settings } from "lucide-react";import { MobileTabBar, type MobileTabBarItem } from "@/components/ui/mobile-tab-bar";const items: MobileTabBarItem[] = [  { id: "home", label: "Home", icon: <Home />, href: "/" },  { id: "alerts", label: "Alerts", icon: <Bell />, badge: 120, href: "/alerts" },  { id: "settings", label: "Settings", icon: <Settings />, badge: true, href: "/settings" },];export default function App() {  const [tab, setTab] = React.useState("home");  return <MobileTabBar items={items} value={tab} onValueChange={setTab} labels="active" />;}

Centre action with docked light theme

Splits two tabs on each side of a raised round button. Uses the docked variant with the light palette, so the bar sits flush with the bottom edge.

centre-action-with-docked-light-theme.tsx
import { Plus, House, Search, User } from "lucide-react";import { MobileTabBar, type MobileTabBarItem } from "@/components/ui/mobile-tab-bar";const items: MobileTabBarItem[] = [  { id: "home", label: "Home", icon: <House /> },  { id: "search", label: "Search", icon: <Search /> },  { id: "profile", label: "Profile", icon: <User /> },];export default function Feed() {  return (    <MobileTabBar      items={items}      theme="light"      variant="docked"      centerAction={{ label: "New post", icon: <Plus />, onClick: () => console.log("compose") }}    />  );}

Non-fixed bar inside a phone-sized container

Sets fixed to false so the bar is absolutely positioned at the bottom of its relatively positioned parent instead of the viewport.

non-fixed-bar-inside-a-phone-sized-container.tsx
import { MobileTabBar } from "@/components/ui/mobile-tab-bar";export default function PhoneFrame() {  return (    <div className="relative mx-auto h-[640px] w-[360px] overflow-hidden rounded-3xl bg-neutral-100">      <MobileTabBar fixed={false} size="sm" theme="light" labels="none" />    </div>  );}

API reference

PropTypeDefaultDescription
itemsMobileTabBarItem[]DEFAULT_ITEMS (Home, Search, Inbox with badge 3, Profile)Tabs to render. Each item has id, label, icon (ReactNode), optional badge (number shows a count, 99+ above 99; true shows a dot) and optional href (renders an anchor instead of a button).
valuestring—Currently selected item id for controlled usage. When provided, internal state is ignored.
defaultValuestringitems[0]?.idInitially selected item id for uncontrolled usage.
onValueChange(id: string) => void—Called with the item id whenever a tab is selected.
centerActionMobileTabBarAction—Raised round button placed between the two halves of the tabs. Has label (used as aria-label), optional icon (defaults to a plus sign) and optional onClick.
variant"docked" | "floating""floating"docked is flush with the bottom edge with a top border; floating is a rounded, inset bar with a shadow.
labels"always" | "active" | "none""always"Shows labels on all tabs, only on the active tab, or hides them (labels are then exposed through aria-label).
fixedbooleantruePins the bar to the viewport bottom with fixed positioning. Set false to use absolute positioning inside a relatively positioned container.
size"sm" | "md" | "lg""md"Sets bar height (56, 64 or 72px), icon size, label font size and centre action diameter (46, 52 or 58px).
theme"dark" | "light""dark"Selects the colour palette for background, text, pill, badge and centre action.
classNamestring—Extra classes merged onto the outer nav element via tailwind-merge.

Accessibility

  • The outer element is a nav with aria-label "Main"; the active tab gets aria-current="page".
  • When labels is "none", each tab receives an aria-label equal to its label so screen readers still announce it.
  • Numeric badges add visually hidden text such as ", 3 new" to the tab; dot badges (true) add no announcement.
  • Arrow Left/Right move focus between tabs with wrap-around, and Home/End jump to the first or last tab, following a roving keyboard pattern.
  • Focus is shown with a visible ring (focus-visible) using the theme's focus colour.
  • The centre action button has aria-label set from centerAction.label, so provide a meaningful label.
  • Pill and bounce animations use motion; when the user prefers reduced motion (useReducedMotion), the layout pill animation and the icon entrance bounce are disabled.
  • Icon nodes from the default items are aria-hidden; provide aria-hidden on custom icons or rely on the label text.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Mobile Tab Bar" component (reactframe/mobile-tab-bar) from its shadcn registry.1. Install it with: npx shadcn@latest add @reactframe/mobile-tab-bar2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: items, value, defaultValue, onValueChange, centerAction, variant, labels, fixed, size, theme, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { MobileTabBar } from "@/components/ui/mobile-tab-bar";<MobileTabBar />```

Files & dependencies

  • registry/new-york/mobile-tab-bar/mobile-tab-bar.tsx
dependenciesmotionclsxtailwind-merge

Looks similar, elsewhere