/** Tabs — a horizontal, optionally closable tab bar (LD). * * Presentation-only and controlled: the parent owns the active id and the open * set. Used for the project tab bar (one tab per open project, ARCHITECTURE §10) * but generic enough for any tabbed surface. */ import { cn } from "../lib/cn"; import { IconButton } from "./IconButton"; export interface TabItem { /** Stable id, returned by `onSelect`/`onClose`. */ id: string; /** Visible label. */ label: string; } export interface TabsProps { /** Tabs to render, left to right. */ items: TabItem[]; /** Currently-active tab id. */ value: string | null; /** Called with the id of the tab the user activates. */ onSelect: (id: string) => void; /** When provided, each tab shows a close (×) control. */ onClose?: (id: string) => void; className?: string; } /** A themed tab strip with selection and optional per-tab close. */ export function Tabs({ items, value, onSelect, onClose, className }: TabsProps) { return (
{items.map((tab) => { const active = tab.id === value; return (
{onClose && ( onClose(tab.id)} className="opacity-60 group-hover:opacity-100" > × )}
); })}
); }