'use client'; import * as React from 'react'; import { cn } from '@/lib/utils'; interface TabsContext { value: string; setValue: (v: string) => void; } const TabsCtx = React.createContext({ value: '', setValue: () => {} }); export function Tabs({ value: controlled, onValueChange, defaultValue, children, className, }: { value?: string; onValueChange?: (v: string) => void; defaultValue?: string; children: React.ReactNode; className?: string; }) { const [internal, setInternal] = React.useState(defaultValue || ''); const value = controlled ?? internal; const setValue = (v: string) => { if (!controlled) setInternal(v); onValueChange?.(v); }; return (
{children}
); } export function TabsList({ className, ...props }: React.HTMLAttributes) { return (
); } export function TabsTrigger({ value, className, ...props }: React.ButtonHTMLAttributes & { value: string }) { const { value: active, setValue } = React.useContext(TabsCtx); return (