---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Tab bar

A phone screen's bottom navigation, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `TabBar`.

## Try it

Press a destination at the screen’s foot (or Tab onto one and press Enter or Space): the bar marks it and the screen shows its page. Opening Inbox reads its 3 new notes, so its count goes; pressing the current one again says it is already open. The line under the screen says what the last press did, and counts every press.

The destinations and their pages are our own and live in this page alone: nothing is opened or read anywhere.

## When to use

- A phone screen's bottom navigation.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Tab bar on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tab-bar.json --yes
```

```text
Add the Goop Tab bar to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { useState } from 'react';
import { TabBar, TabBarItem } from '@/components/ui/goop/tab-bar';

function PhoneNav() {
  const [section, setSection] = useState('today');
  const [searching, setSearching] = useState(false);
  return (
    <TabBar value={section} onValueChange={setSection} className="narrow:hidden">
      <TabBarItem value="today" icon="calendar" href="#today">
        Today
      </TabBarItem>
      <TabBarItem value="inbox" icon="inbox" href="#inbox" count={3}>
        Inbox
      </TabBarItem>
      <TabBarItem value="search" icon="search" onSelect={() => setSearching(!searching)}>
        Search
      </TabBarItem>
      <TabBarItem value="profile" icon="user" href="#profile">
        Profile
      </TabBarItem>
    </TabBar>
  );
}
```

- Fits: frame (its recipe); frame: phone-nav (places: few).
- Also known as: BottomNavigation, BottomNav, BottomTabs.
- height, width, padding, gap, corner, border, background, text: add no class for these.

## API reference

### Options

- `value?: string` — The current destination's `value`, held by you; give `onValueChange` with it.
- `defaultValue?: string` — The destination current at first, when the bar holds it.
- `onValueChange?: (value: string) => void` — Called with a destination's `value` when a press, a tap, Enter or Space selects another one.
- `position?: 'sticky' | 'fixed' | 'static' = 'sticky'` — `sticky` (the default) stands at the foot of what scrolls — the page, or a column it ends — and takes its own room; `fixed` stands over the window's foot (leave the page that room); `static` stays where it is written.
- `Defaults: aria-label = 'Main'`

- State: value (value / defaultValue / onValueChange); drawn by data-focus-visible

### Parts

- `TabBarItem` — One destination of a TabBar; takes asChild; value: string — The destination's name for the bar's `value`; icon: IconName — The pack icon over the word, by its name; children: ReactNode — The short word under the icon (with `asChild`, your element, its children the word); href?: string — Where it goes; left out (and no `asChild`), the destination is a button that runs `onSelect`; onSelect?: () => void — Runs on every press, Enter or Space, the current destination's too (scroll its page to the top, open a search); onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> — Your press handler, before the bar's; `event.preventDefault()` keeps the current destination; count?: number — How many are new there, drawn as a disc at the icon's top end (9+ past 9); none at 0 or left out; countLabel?: (count: number) => string — The words a screen reader hears for the count after the name (`(n) => \`${n} unread\``); the number by default

- data-slot values (to select a part by): tab-bar, tab-bar-item, tab-bar-item-badge, tab-bar-item-control, tab-bar-item-icon, tab-bar-item-label, tab-bar-list

## Keyboard

- Tab: move to the next destination (each destination is one tab stop), then out of the bar
- Enter: go to the focused destination: it becomes the current one
- Space: go to the focused destination, as Enter (on a link too)

## Accessibility

- The native element answers the keyboard.
- hover, active, focus: the browser's own (:hover, :active, :focus): write nothing
- focus-visible: the attribute data-focus-visible
- current: the attribute aria-current=page

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Tool call](/themes/meadow/components/tool-call): One tool call of an assistant's run, as a quiet row that opens onto its input and output.
- [Week calendar](/themes/meadow/components/week-calendar): A week of events by the hour, the days across and the hours down, with an all-day row.
- [Sortable list](/themes/meadow/components/sortable-list): A list of rows a person puts in order, by dragging a row's handle or by the keys (Space, the arrows, Space), each step said aloud.
- [Reply status](/themes/meadow/components/reply-status): The line an AI reply shows while it thinks and after it.
