Navigation
Tabs
Underline tabs with a 2px text-primary indicator.
react-aria-components
Preview
Overview
Activity 14
Buying signals
Notes
Profile, company and ICP fit.
"use client";
import { Counter } from "@/components/ui/counter";
import { Tab, TabList, TabPanel, Tabs } from "@/components/ui/tabs";
export default function Example() {
return (
<Tabs className="w-full max-w-xl">
<TabList aria-label="Prospect detail">
<Tab id="overview">Overview</Tab>
<Tab id="activity">Activity <Counter>14</Counter></Tab>
<Tab id="signals">Buying signals</Tab>
<Tab id="notes">Notes</Tab>
</TabList>
<TabPanel id="overview" className="text-fg-secondary">Profile, company and ICP fit.</TabPanel>
<TabPanel id="activity" className="text-fg-secondary">Emails, replies and meetings.</TabPanel>
<TabPanel id="signals" className="text-fg-secondary">Funding, hiring and intent signals.</TabPanel>
<TabPanel id="notes" className="text-fg-secondary">Team notes.</TabPanel>
</Tabs>
);
}Installation
Components are copied into your project — no runtime package.
Install the following dependencies:
terminalnpm install react-aria-componentsCreate a
tabs.tsxfile and paste the following code into it.src/components/ui/tabs.tsx"use client"; import type { ReactNode } from "react"; import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, Tabs as AriaTabs, type TabListProps, type TabPanelProps, type TabProps, type TabsProps, } from "react-aria-components"; import { cx } from "@/utils/cx"; export function Tabs({ className, ...props }: Omit<TabsProps, "className"> & { className?: string }) { return <AriaTabs {...props} className={cx("flex flex-col", className)} />; } export function TabList<T extends object>({ className, ...props }: Omit<TabListProps<T>, "className"> & { className?: string }) { return <AriaTabList {...props} className={cx("flex gap-6 border-b border-line", className)} />; } /** Underline tab — 2px text-primary indicator on the selected tab. */ export function Tab({ className, children, ...props }: Omit<TabProps, "className" | "children"> & { className?: string; children: ReactNode }) { return ( <AriaTab {...props} className={cx( "relative -mb-px flex h-10 cursor-default items-center gap-2 border-b-2 border-transparent text-base font-medium text-fg-secondary outline-none transition-colors", "data-hovered:text-fg data-selected:border-fg data-selected:text-fg data-focus-visible:rounded-xs data-focus-visible:shadow-focus", className, )} > {children} </AriaTab> ); } export function TabPanel({ className, ...props }: Omit<TabPanelProps, "className"> & { className?: string }) { return <AriaTabPanel {...props} className={cx("pt-4 outline-none", className)} />; }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.