Componentnavigation1.63 KB gzipZero dependencies

Tabs

Segmented panel switch with roving keyboard focus.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add tabs

Or install the full npm package:

npm install bigbullui

Usage

tsx10 lines
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; <Tabs defaultValue="one">  <TabsList>    <TabsTrigger value="one">One</TabsTrigger>    <TabsTrigger value="two">Two</TabsTrigger>  </TabsList>  <TabsContent value="one">First.</TabsContent>  <TabsContent value="two">Second.</TabsContent></Tabs>

Source code

tabs.tsx + 3 helpers

Zero third-party dependencies (4 local files shown in tabs below).

tsxtabs.tsx244 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils";import { useDirection, type Direction } from "./lib/direction";import { inertProp } from "./lib/react-compat"; type TabsContextValue = {  value: string;  activeTabStop?: string;  setValue: (v: string) => void;  baseId: string;  animated: boolean;  orientation: "horizontal" | "vertical";  activationMode: "automatic" | "manual";  dir: Direction;};const TabsCtx = React.createContext<TabsContextValue | null>(null);

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { Tabs } from "@/components/ui/tabs"; <Tabs />
PropTypeDescription
valuestringControlled active tab value.
defaultValuestringInitially active tab value.
onValueChange(value: string) => voidCalled when active tab changes.
orientation"horizontal" | "vertical"Layout and keyboard navigation axis. (Default: "horizontal")
activationMode"automatic" | "manual"Configures activation mode. (Default: "automatic")
dirDirectionExplicit reading direction override (ltr or rtl).
animatedbooleanDual-mode: false renders instantly with no motion. Default true.