Componentnavigation0.7 KB gzipZero dependencies

Page Tabs

In-page tabs synced to URL query parameter.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add page-tabs

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { PageTabs } from "@/components/ui/page-tabs"; <PageTabs />

Source code

page-tabs.tsx + 1 helper

Zero 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 />
PropTypeDescription
tabs{ id: string; label: string; param?: string }[]Configures tabs. (Default: [])
activeIdstringConfigures active id.
onNavigate(id: string) => voidCallback invoked on navigate.