---
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/"
---

# Tabs

A row of tabs that switch between panels of content in one place, such as a record's overview and activity, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Tabs`.

## Try it

Switch views with a click or the arrow keys (Home and End too): the indicator moves and the panel changes. Change the row’s variant, or leave the panels out.

The tasks are words of our own.

## When to use

- A row of tabs that switch between panels of content in one place, such as a record's overview and activity.
- Also called: tab bar.

## 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 Tabs on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-tabs
```

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

## Usage

```tsx
import { Tabs, TabsList, TabsTrigger, TabsAction, TabsContent } from '@/components/ui/goop/tabs';

<Tabs defaultValue="all">
  <TabsList>
    <TabsTrigger value="all" count={12} countLabel={(n) => `${n} open`}>
      All
    </TabsTrigger>
    <TabsTrigger value="mine" count={3} countLabel={(n) => `${n} open`}>
      Mine
    </TabsTrigger>
  </TabsList>
  <TabsContent value="all">…</TabsContent>
</Tabs>
```

- Fits: record (its recipe).
- Queue tabs with counts above a list: give each `TabsTrigger` its `count` and a `countLabel` for a screen reader (`count={12} countLabel={(n) => \`${n} open\`}` reads "Orders, 12 open"); a zero is drawn.
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `value?: string`
- `defaultValue?: string`
- `onValueChange?: (value: string) => void`

- State: value (value / defaultValue / onValueChange); drawn by data-state=open

### Parts

- `TabsList` — The row of tabs; variant: default (default), ghost, segmented, outline; action?: ReactNode — A control after the tabs, outside the tablist (a `TabsAction`); none by default; size?: 'sm' | 'md' = 'md' — The quiet and outlined rows' tab sides (the view pills and the segments keep theirs): `md` (the default) 12 px, `sm` 4 px for a tight row such as five presets in a 268 px layer; the tabs keep their height and touch size
- `TabsTrigger` — One tab in the TabsList; its value names the TabsContent it shows; count?: number — How many the tab's view holds ("Orders 12"), drawn after its words as a quiet number; 0 is drawn (an empty queue says so), and a tab with no `count` draws none; countLabel?: (count: number) => string — The words a screen reader hears for the count after the tab's name (`(n) => \`${n} open\``); the number by default; also takes value: string; disabled?: boolean
- `TabsAction` — A trailing control of the row (a new view, a view's options); icon: IconName — A pack icon name (an outline or a filled one); also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'
- `TabsContent` — The panel a tab shows; also takes value: string

- Class recipes (cva): tabsListVariants (TabsList)
- data-slot values (to select a part by): tabs, tabs-content, tabs-edge, tabs-hover, tabs-indicator, tabs-list, tabs-list-inner, tabs-trigger, tabs-trigger-count, tabs-trigger-label

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover, active, focus-visible, focus-within: the browser's own (:hover, :active, :focus-visible, :focus-within): write nothing
- selected: the attribute aria-selected
- expanded: the attribute data-state=open
- open: the attribute data-state=open
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## 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

- [Breadcrumb](/themes/trail/components/breadcrumb): The row of links from the top of the app down to the current page, so a person can step back up a level.
- [Pagination](/themes/trail/components/pagination): The row of page numbers with previous and next under a long table or list, to move between its pages.
- [Accordion](/themes/trail/components/accordion): Stacked sections that each open and close their own content, for a FAQ or a long page of options.
- [Collapsible](/themes/trail/components/collapsible): One trigger that shows and hides the content right below it, such as more options.
