import React, { useState } from 'react';
import clsx from 'clsx';
export interface TabItem {
key: string;
label: string;
content: React.ReactNode;
badge?: number;
}
export interface TabsProps {
tabs: TabItem[];
defaultKey?: string;
className?: string;
}
export function Tabs({ tabs, defaultKey, className }: TabsProps) {
const [activeKey, setActiveKey] = useState(defaultKey || tabs[0]?.key || '');
const activeTab = tabs.find((t) => t.key === activeKey);
return (
{tabs.map((tab) => (
))}
{activeTab?.content}
);
}