Xzero UI
Pro library

Tabs

Switch between related content in the same context.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/tabs
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/tabs

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/xzero/tabs/tabs";

export function ProjectTabs() {
  return (
    <Tabs defaultValue="overview">
      <TabsList aria-label="Project">
        <TabsTrigger value="overview">Overview</TabsTrigger>
        <TabsTrigger value="activity">Activity</TabsTrigger>
      </TabsList>
      <TabsContent value="overview">Summary and stats</TabsContent>
      <TabsContent value="activity">Recent events</TabsContent>
    </Tabs>
  );
}

API reference

Tabs

Radix Tabs root that tracks direction so panels slide the way the selection moved.

PropTypeDefaultDescription
valuestring–Controlled active tab value.
defaultValuestring–Initial active tab when uncontrolled.
onValueChange(value: string) => void–Called when the active tab changes.
...propsComponentPropsWithoutRef<typeof TabsPrimitive.Root>–Other Radix root props such as activationMode and className.

TabsList

Scrollable tab strip. Shows edge scroll buttons when triggers overflow and keeps the active tab in view.

PropTypeDefaultDescription
...propsComponentPropsWithoutRef<typeof TabsPrimitive.List>–Radix list props, including aria-label and loop.

TabsTrigger

A tab with a shared selection pill that glides between triggers.

PropTypeDefaultDescription
value (required)string–Matches a TabsContent value.
...propsComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>–Radix trigger props such as disabled.

TabsContent

Panel that slides in and morphs its height from the previous panel.

PropTypeDefaultDescription
value (required)string–Matches a TabsTrigger value.
forceMounttrue–Keeps the panel mounted and skips the enter and exit animation.
...propsComponentPropsWithoutRef<typeof TabsPrimitive.Content>–Radix content props such as className.

Keyboard interactions

KeysAction
ArrowLeft / ArrowRightMoves between tabs and activates them.
Home / EndJumps to the first or last tab.
TabMoves focus from the tab list into the active panel.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in navigation

Guidance for AI tools

Tabs: Switch between related content in the same context. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components