npx shadcn@4.23.1 add @goop/meadow-tabsTabs
FreeA row of tabs over the panels they show, one panel at a time, for React and Tailwind CSS. Free, MIT.
What an agent sees
- TabsListThe row of tabs, a
tablist - TabsTriggerOne tab in the TabsList
- TabsActionA trailing control of the row (a new view, a view's options), passed as the TabsList's
action - TabsContentThe panel a tab shows, a
tabpanelnamed by its tab
import { Tabs, TabsAction, TabsContent, TabsList, TabsTrigger } from '@/components/ui/goop/tabs';
function SiteVisitTabs() {
return (
<Tabs defaultValue="overview">
<TabsList aria-label="Site visit" action={<TabsAction icon="plus" aria-label="New view" />}>
<TabsTrigger value="notes" count={21}>
Field notes
</TabsTrigger>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="tasks" count={3} countLabel={(n) => `${n} open`}>
Tasks
</TabsTrigger>
<TabsTrigger value="photos" disabled>
Photos
</TabsTrigger>
</TabsList>
<TabsContent value="notes" className="py-3 text-sm">
Soil samples from the north field
</TabsContent>
<TabsContent value="overview" className="py-3 text-sm">
Drainage looks sound; the culvert needs clearing.
</TabsContent>
<TabsContent value="tasks" className="py-3 text-sm">
Book the survey crew for Friday
</TabsContent>
</Tabs>
);
}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 over the panels they show, one panel at a time.
- 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.
npx shadcn@4.23.1 add @goop/meadow-tabsAdd the Goop Tabs to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Tabs, TabsAction, TabsContent, TabsList, TabsTrigger } from '@/components/ui/goop/tabs';
function SiteVisitTabs() {
return (
<Tabs defaultValue="overview">
<TabsList aria-label="Site visit" action={<TabsAction icon="plus" aria-label="New view" />}>
<TabsTrigger value="notes" count={21}>
Field notes
</TabsTrigger>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="tasks" count={3} countLabel={(n) => `${n} open`}>
Tasks
</TabsTrigger>
<TabsTrigger value="photos" disabled>
Photos
</TabsTrigger>
</TabsList>
<TabsContent value="notes" className="py-3 text-sm">
Soil samples from the north field
</TabsContent>
<TabsContent value="overview" className="py-3 text-sm">
Drainage looks sound; the culvert needs clearing.
</TabsContent>
<TabsContent value="tasks" className="py-3 text-sm">
Book the survey crew for Friday
</TabsContent>
</Tabs>
);
}- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| value? | string | The selected tab's value, held by the caller; with onValueChange. |
| defaultValue? | string | The tab selected at first, when the tabs hold it. |
| onValueChange? | (value: string) => void | Called with the value of the tab just selected. |
- State: value (value / defaultValue / onValueChange)
| Part | What it is |
|---|---|
| TabsList | The row of tabs, a tablist; name it with aria-label where no heading names it; variant?: 'default' | 'ghost' | 'segmented' | 'outline' = 'default' — The row's look: the underlined row (the default), quiet pills, joined framed pills or raised pills; size?: 'sm' | 'md' = 'md' — The quiet and raised pills' sides: md (the default) 10 px, sm 4 px; the tabs keep their height; action?: ReactNode — A control after the tabs, outside the tablist (a TabsAction); none by default |
| TabsTrigger | One tab in the TabsList; its value names the TabsContent it shows; value: string — The tab's name among its siblings: the value of the TabsContent it shows; disabled?: boolean — The tab cannot be selected, and the keyboard passes over it; count?: number — How many the tab's view holds ("Tasks 6"), drawn after its words as small grey figures; 0 is drawn (an empty view 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 |
| TabsAction | A trailing control of the row (a new view, a view's options), passed as the TabsList's action; icon: IconName — A pack icon name; 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, a tabpanel named by its tab; shown while its tab is selected, out of the page otherwise (forceMount keeps it in the page, hidden, for content that must keep its state); also takes value: string |
- Class recipes (cva): tabsListVariants
- data-slot values (to select a part by): tabs, tabs-badge, tabs-content, tabs-indicator, tabs-label, tabs-list, tabs-row, tabs-trigger
Keyboard
| Key | What it does |
|---|---|
| ArrowLeft ArrowRight | Move selection |
| Home | Move selection |
| End | Move selection |
Accessibility
- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover, active, focus, focus-visible, focus-within: the browser's own (:hover, :active, :focus, :focus-visible, :focus-within): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| selected | the attribute aria-selected |
| 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.