Componentnavigation0.7 KB gzipZero dependencies
Page Tabs
In-page tabs synced to URL query parameter.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add page-tabsOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { PageTabs } from "@/components/ui/page-tabs"; <PageTabs />Source code
page-tabs.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxpage-tabs.tsx53 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface PageTabsProps extends React.HTMLAttributes<HTMLDivElement> { tabs: { id: string; label: string; param?: string }[]; activeId?: string; onNavigate?: (id: string) => void;} /** In-page tab navigation synchronized with URL query params (?tab=...). */export function PageTabs({ tabs = [], activeId, onNavigate, className, ...props }: PageTabsProps) { const [internal, setInternal] = React.useState(activeId ?? tabs[0]?.id); const active = activeId ?? internal; const select = (id: string) => { setInternal(id);Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { PageTabs } from "@/components/ui/page-tabs"; <PageTabs />| Prop | Type | Description |
|---|---|---|
| tabs | { id: string; label: string; param?: string }[] | Configures tabs. (Default: []) |
| activeId | string | Configures active id. |
| onNavigate | (id: string) => void | Callback invoked on navigate. |