import * as React from 'react'; import { motion } from 'framer-motion'; import { cn } from '@/lib/utils'; import { Badge } from '@/components/ui/badge'; /** * Tabs — switches between views of the same page. * * Two visual styles: * - `pill` — matches the app's header navigation, with a sliding indicator * - `underline` — quieter, for tabs inside a card * * The sliding indicator uses a shared `layoutId`, so the highlight animates * between tabs the same way the main nav pill does. `layoutGroupId` must be * unique when two tab sets are on screen at once, otherwise the indicator * animates between them. */ /** @param {any} props */ export function Tabs({ tabs = [], value, onChange, variant = 'pill', size = 'default', layoutGroupId, className, ariaLabel = 'Views', }) { const normalized = tabs.map((t) => (typeof t === 'string' ? { value: t, label: t } : t)); const fallbackId = React.useId(); const groupId = layoutGroupId || fallbackId; if (variant === 'underline') { return (
{normalized.map((tab) => { const active = tab.value === value; return ( ); })}
); } return (
{normalized.map((tab) => { const active = tab.value === value; return ( ); })}
); }