murad-sinatra

Tab Bar

Component

About

A mobile bottom navigation bar with icon-plus-label destinations, optional unread badges, and safe-area padding for app-style screens.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tab Bar to your project and fits it to your theme.

Code

How Tab Bar is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import TabBar, { TabBarItem } from "@/components/ui/tab-bar";

function HomeIcon() {
  return (
    <svg
      width="22"
      height="22"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
    >
      <path d="M3 10.5 12 3l9 7.5" />
      <path d="M5 9.5V20a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1V9.5" />
    </svg>
  );
}

function SearchIcon() {
  return (
    <svg
      width="22"
      height="22"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
    >
      <circle cx="11" cy="11" r="7" />
      <path d="M21 21l-4.3-4.3" />
    </svg>
  );
}

function BellIcon() {
  return (
    <svg
      width="22"
      height="22"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
    >
      <path d="M6 8a6 6 0 1 1 12 0c0 3.2 1 5 1.8 6.2a1 1 0 0 1-.8 1.8H5a1 1 0 0 1-.8-1.8C5 13 6 11.2 6 8Z" />
      <path d="M9.5 18.5a2.5 2.5 0 0 0 5 0" />
    </svg>
  );
}

function UserIcon() {
  return (
    <svg
      width="22"
      height="22"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      strokeLinejoin="round"
    >
      <circle cx="12" cy="8" r="3.5" />
      <path d="M4.5 20c1.4-3.5 4.3-5.5 7.5-5.5s6.1 2 7.5 5.5" />
    </svg>
  );
}

const SCREENS: Record<string, { title: string; copy: string }> = {
  home: { title: "Home", copy: "Your feed and shortcuts live here." },
  search: { title: "Search", copy: "Find people, places and posts." },
  alerts: { title: "Alerts", copy: "Three unread notifications." },
  profile: { title: "Profile", copy: "Account details and settings." },
};

export default function TabBarDemo() {
  const [tab, setTab] = React.useState("home");
  const screen = SCREENS[tab];

  return (
    <div
      className="flex h-screen w-full flex-col justify-end"
      style={{
        background: "var(--mors-color-canvas)",
        fontFamily: "var(--mors-font-sans)",
      }}
    >
      <div className="flex flex-1 flex-col items-center justify-center gap-1 px-6 text-center">
        <p
          className="text-base font-medium"
          style={{ color: "var(--mors-color-text)" }}
        >
          {screen.title}
        </p>
        <p
          className="text-sm"
          style={{ color: "var(--mors-color-text-secondary)" }}
        >
          {screen.copy}
        </p>
      </div>
      <TabBar value={tab} onValueChange={setTab} visibility="always">
        <TabBarItem value="home" icon={<HomeIcon />} label="Home" />
        <TabBarItem value="search" icon={<SearchIcon />} label="Search" />
        <TabBarItem
          value="alerts"
          icon={<BellIcon />}
          label="Alerts"
          badge={3}
        />
        <TabBarItem value="profile" icon={<UserIcon />} label="Profile" />
      </TabBar>
    </div>
  );
}

More by murad-sinatra

View all
  • Event Calendar

    Event Calendar

    63
  • Table

    Table

    8
  • Drawer

    Drawer

    7
  • Combobox

    Combobox

    4
  • Toggles

    Toggles

    4
  • Command Palette

    Command Palette

    3
  • Mors Card

    Mors Card

    3
  • Token Field

    Token Field

    3