# Mobile tab bar

The bottom tab bar for an AI app, with a pill that slides between tabs on a spring and badges that say what is waiting.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Mobile tab bar. Tap between tabs: the pill slides on a spring. Agents has three runs waiting. Preview: https://chatcn.dev/preview/mobile-tab-bar-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/mobile-tab-bar
```

## Usage

```tsx
import { MobileTabBar } from "@/components/ui/chatcn/pro/mobile-tab-bar"

<MobileTabBar
  tabs={[
    { id: "chats", label: "Chats", icon: <MessagesSquareIcon /> },
    { id: "agents", label: "Agents", icon: <BotIcon />, badge: 3 },
    { id: "library", label: "Library", icon: <LibraryIcon /> },
    { id: "settings", label: "Settings", icon: <SettingsIcon />, badge: true },
  ]}
  value={tab}
  onValueChange={setTab}
/>
```

A soft pill sits behind the active tab and slides to the next on a critically damped spring; the active icon thickens and its label goes to full ink. Badges take a count (99+ past 99) or `true` for a dot, in blue, the kit's color for something new rather than something wrong, and are spoken with the tab. The bar is translucent over what scrolls under it and clears the home indicator through the safe area. Mirrored in right to left layouts.

## Examples

### States

Example: States. Three tabs with a large count, and right to left. Preview: https://chatcn.dev/preview/mobile-tab-bar-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `tabs` | `MobileTab[]` | `{ id, label, icon, badge? }` |
| `value`, `defaultValue`, `onValueChange` | `string` | The active tab |
| `labels` | `Partial<MobileTabBarLabels>` | The bar's name and badge words |

## Keyboard

| Key | Action |
| --- | --- |
| Tab | One stop: the active tab |
| Arrow left, right | Previous or next tab, selected as it moves (reversed right to left) |
| Home, End | First or last tab |

## Accessibility

- A labelled navigation landmark with a tab list; tabs report which one is selected.
- Badges are read as part of the tab: Agents, 3 new.

## Motion

The pill slides over 460 ms on a critically damped spring and icons dip to 90% while pressed. Under reduced motion the pill moves in place.

Source: https://chatcn.dev/docs/components/mobile-tab-bar