{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tabs",
  "title": "Tabs",
  "description": "An accessible tab set with underline, pill and segmented variants, a sliding animated indicator, icons, counts, arrow-key navigation and animated content panels.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/tabs/tabs.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface TabItem {\n  value: string;\n  label: string;\n  icon?: React.ReactNode;\n  count?: number;\n  disabled?: boolean;\n  content?: React.ReactNode;\n}\n\nexport type TabsVariant = \"underline\" | \"pill\" | \"segmented\";\nexport type TabsSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface TabsProps {\n  items?: TabItem[];\n  value?: string;\n  defaultValue?: string;\n  onValueChange?: (value: string) => void;\n  variant?: TabsVariant;\n  size?: TabsSize;\n  theme?: \"dark\" | \"light\";\n  accentColor?: string;\n  fullWidth?: boolean;\n  className?: string;\n}\n\nconst DEFAULT_ITEMS: TabItem[] = [\n  { value: \"overview\", label: \"Overview\", content: \"A quick summary of your workspace: recent activity, open tasks and what changed since yesterday.\" },\n  { value: \"analytics\", label: \"Analytics\", content: \"Traffic, conversion and retention trends, broken down by channel and cohort.\" },\n  { value: \"reports\", label: \"Reports\", content: \"Scheduled and on-demand reports you can export or share with your team.\" },\n  { value: \"settings\", label: \"Settings\", content: \"Members, billing, integrations and workspace preferences.\" },\n];\n\nconst PALETTES = {\n  dark: { text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.5)\", line: \"rgba(255,255,255,0.1)\", track: \"rgba(255,255,255,0.05)\", thumb: \"#F5F4F1\", thumbText: \"#0A0A0A\", panelText: \"rgba(245,244,241,0.7)\", badge: \"rgba(255,255,255,0.08)\" },\n  light: { text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.5)\", line: \"rgba(10,10,10,0.1)\", track: \"rgba(10,10,10,0.05)\", thumb: \"#FFFFFF\", thumbText: \"#0A0A0A\", panelText: \"rgba(10,10,10,0.7)\", badge: \"rgba(10,10,10,0.06)\" },\n};\n\nconst SIZES: Record<TabsSize, { font: number; padX: number; padY: number; gap: number; icon: number }> = {\n  sm: { font: 13, padX: 12, padY: 7, gap: 6, icon: 14 },\n  md: { font: 14, padX: 16, padY: 9, gap: 7, icon: 16 },\n  lg: { font: 15.5, padX: 20, padY: 11, gap: 8, icon: 18 },\n};\n\nexport function Tabs({ items = DEFAULT_ITEMS, value, defaultValue, onValueChange, variant = \"underline\", size = \"md\", theme = \"dark\", accentColor = \"#F2A841\", fullWidth = false, className }: TabsProps) {\n  const p = PALETTES[theme];\n  const s = SIZES[size];\n  const uid = React.useId();\n  const firstEnabled = items.find((i) => !i.disabled)?.value ?? items[0]?.value;\n  const [internal, setInternal] = React.useState(defaultValue ?? firstEnabled);\n  const isControlled = value !== undefined;\n  const current = isControlled ? value : internal;\n  const tabRefs = React.useRef<Record<string, HTMLButtonElement | null>>({});\n  const activeItem = items.find((i) => i.value === current);\n  const hasPanels = items.some((i) => i.content !== undefined);\n\n  const select = (v: string) => {\n    if (!isControlled) setInternal(v);\n    onValueChange?.(v);\n  };\n\n  const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    const enabled = items.filter((i) => !i.disabled);\n    if (enabled.length === 0) return;\n    const idx = enabled.findIndex((i) => i.value === current);\n    let next: TabItem | undefined;\n    if (e.key === \"ArrowRight\") next = enabled[(idx + 1) % enabled.length];\n    else if (e.key === \"ArrowLeft\") next = enabled[(idx - 1 + enabled.length) % enabled.length];\n    else if (e.key === \"Home\") next = enabled[0];\n    else if (e.key === \"End\") next = enabled[enabled.length - 1];\n    if (!next) return;\n    e.preventDefault();\n    select(next.value);\n    tabRefs.current[next.value]?.focus();\n  };\n\n  const listStyle: React.CSSProperties =\n    variant === \"underline\"\n      ? { borderBottom: `1px solid ${p.line}` }\n      : variant === \"segmented\"\n        ? { background: p.track, padding: 4, borderRadius: 14, border: `1px solid ${p.line}` }\n        : { gap: 4 };\n\n  return (\n    <div className={cn(fullWidth ? \"flex w-full flex-col\" : \"inline-flex flex-col\", className)} style={{ fontFamily: \"Inter, sans-serif\" }}>\n      <div role=\"tablist\" aria-orientation=\"horizontal\" onKeyDown={onKeyDown} className={cn(\"relative flex\", fullWidth ? \"w-full\" : \"w-fit max-w-full overflow-x-auto\")} style={listStyle}>\n        {items.map((item) => {\n          const active = item.value === current;\n          return (\n            <button\n              key={item.value}\n              ref={(el) => {\n                tabRefs.current[item.value] = el;\n              }}\n              type=\"button\"\n              role=\"tab\"\n              id={`${uid}-tab-${item.value}`}\n              aria-selected={active}\n              aria-controls={hasPanels ? `${uid}-panel-${item.value}` : undefined}\n              tabIndex={active ? 0 : -1}\n              disabled={item.disabled}\n              onClick={() => !item.disabled && select(item.value)}\n              className=\"relative flex shrink-0 items-center justify-center border-none bg-transparent font-semibold tracking-[-0.01em] whitespace-nowrap outline-none focus-visible:z-10\"\n              style={{\n                flex: fullWidth ? 1 : undefined,\n                gap: s.gap,\n                padding: `${s.padY}px ${s.padX}px`,\n                fontSize: s.font,\n                color: variant === \"segmented\" && active ? p.thumbText : variant === \"pill\" && active ? accentColor : active ? p.text : p.muted,\n                borderRadius: variant === \"segmented\" ? 10 : variant === \"pill\" ? 999 : 0,\n                cursor: item.disabled ? \"default\" : \"pointer\",\n                opacity: item.disabled ? 0.4 : 1,\n                transition: \"color 0.2s ease\",\n              }}\n            >\n              {active && variant === \"underline\" && (\n                <motion.span layoutId={`${uid}-indicator`} className=\"absolute right-0 bottom-[-1px] left-0\" style={{ height: 2, borderRadius: 2, background: accentColor }} transition={{ type: \"spring\", stiffness: 520, damping: 38 }} />\n              )}\n              {active && variant === \"pill\" && (\n                <motion.span layoutId={`${uid}-indicator`} className=\"absolute inset-0\" style={{ borderRadius: 999, background: `color-mix(in srgb, ${accentColor} 16%, transparent)`, border: `1px solid color-mix(in srgb, ${accentColor} 30%, transparent)` }} transition={{ type: \"spring\", stiffness: 520, damping: 38 }} />\n              )}\n              {active && variant === \"segmented\" && (\n                <motion.span layoutId={`${uid}-indicator`} className=\"absolute inset-0\" style={{ borderRadius: 10, background: p.thumb, boxShadow: \"0 1px 4px rgba(0,0,0,0.25)\" }} transition={{ type: \"spring\", stiffness: 520, damping: 38 }} />\n              )}\n              {item.icon && (\n                <span className=\"relative flex shrink-0 items-center justify-center\" style={{ width: s.icon, height: s.icon }}>\n                  {item.icon}\n                </span>\n              )}\n              <span className=\"relative\">{item.label}</span>\n              {item.count !== undefined && (\n                <span className=\"relative rounded-full font-bold tabular-nums\" style={{ padding: \"0 6px\", fontSize: s.font * 0.78, lineHeight: `${s.font * 1.25}px`, background: active && variant !== \"segmented\" ? `color-mix(in srgb, ${accentColor} 20%, transparent)` : variant === \"segmented\" && active ? \"rgba(0,0,0,0.08)\" : p.badge, color: active && variant !== \"segmented\" ? accentColor : \"inherit\" }}>\n                  {item.count}\n                </span>\n              )}\n            </button>\n          );\n        })}\n      </div>\n\n      {hasPanels && (\n        <AnimatePresence mode=\"wait\" initial={false}>\n          {activeItem && (\n            <motion.div\n              key={activeItem.value}\n              role=\"tabpanel\"\n              id={`${uid}-panel-${activeItem.value}`}\n              aria-labelledby={`${uid}-tab-${activeItem.value}`}\n              tabIndex={0}\n              className=\"outline-none\"\n              style={{ paddingTop: 18, color: p.panelText, fontSize: s.font, lineHeight: 1.6 }}\n              initial={{ opacity: 0, y: 6 }}\n              animate={{ opacity: 1, y: 0 }}\n              exit={{ opacity: 0, y: -4 }}\n              transition={{ duration: 0.16, ease: [0.16, 1, 0.3, 1] }}\n            >\n              {activeItem.content}\n            </motion.div>\n          )}\n        </AnimatePresence>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}