import { ReactNode, useState } from "react"; import { cn } from "../lib/cn"; interface Tab { value: string; label: string; content: ReactNode; } interface Props { tabs: Tab[]; initial?: string; } export function Tabs({ tabs, initial }: Props) { const [active, setActive] = useState(initial ?? tabs[0]?.value); return (
{tabs.map((t) => ( ))}
{tabs.find((t) => t.value === active)?.content}
); }