{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-tabs",
  "title": "Animated Tabs",
  "author": "VenusUI",
  "description": "Tabs with a sliding underline and fading panels, following the WAI-ARIA tabs pattern.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "registry/default/ui/animated-tabs.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { LayoutGroup, motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface AnimatedTab {\n  value: string\n  label: React.ReactNode\n  content: React.ReactNode\n}\n\ninterface AnimatedTabsProps {\n  tabs: AnimatedTab[]\n  /** Initially selected tab. Defaults to the first. */\n  defaultValue?: string\n  onValueChange?: (value: string) => void\n  /** Accessible name for the tab list. */\n  label: string\n  className?: string\n}\n\n/**\n * Tabs with an underline that slides to the selected tab and panels that\n * fade in. Follows the WAI-ARIA tabs pattern: arrow keys, Home and End move\n * between tabs, and each panel is labelled by its tab.\n */\nfunction AnimatedTabs({ tabs, defaultValue, onValueChange, label, className }: AnimatedTabsProps) {\n  const [value, setValue] = React.useState(defaultValue ?? tabs[0]?.value)\n  const reduceMotion = useReducedMotion()\n  const id = React.useId()\n  const refs = React.useRef<(HTMLButtonElement | null)[]>([])\n\n  function select(next: string, index: number) {\n    setValue(next)\n    onValueChange?.(next)\n    refs.current[index]?.focus()\n  }\n\n  function onKeyDown(event: React.KeyboardEvent, index: number) {\n    const last = tabs.length - 1\n    const target =\n      event.key === \"ArrowRight\" ? (index === last ? 0 : index + 1)\n      : event.key === \"ArrowLeft\" ? (index === 0 ? last : index - 1)\n      : event.key === \"Home\" ? 0\n      : event.key === \"End\" ? last\n      : undefined\n    if (target === undefined) return\n    event.preventDefault()\n    const tab = tabs[target]\n    if (tab) select(tab.value, target)\n  }\n\n  const active = tabs.find((tab) => tab.value === value) ?? tabs[0]\n\n  return (\n    <div data-slot=\"animated-tabs\" className={cn(\"w-full\", className)}>\n      <LayoutGroup id={id}>\n        <div role=\"tablist\" aria-label={label} className=\"flex gap-1 border-b\">\n          {tabs.map((tab, index) => {\n            const selected = tab.value === active?.value\n            return (\n              <button\n                key={tab.value}\n                ref={(node) => {\n                  refs.current[index] = node\n                }}\n                id={`${id}-tab-${tab.value}`}\n                type=\"button\"\n                role=\"tab\"\n                aria-selected={selected}\n                aria-controls={`${id}-panel-${tab.value}`}\n                tabIndex={selected ? 0 : -1}\n                onClick={() => select(tab.value, index)}\n                onKeyDown={(event) => onKeyDown(event, index)}\n                className={cn(\n                  \"relative px-3 py-2 text-sm font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50\",\n                  selected ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\"\n                )}\n              >\n                {tab.label}\n                {selected ? (\n                  <motion.span\n                    layoutId=\"animated-tabs-underline\"\n                    aria-hidden=\"true\"\n                    className=\"absolute inset-x-0 -bottom-px h-0.5 bg-primary\"\n                    transition={reduceMotion ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 40 }}\n                  />\n                ) : null}\n              </button>\n            )\n          })}\n        </div>\n      </LayoutGroup>\n      {active ? (\n        <motion.div\n          key={active.value}\n          id={`${id}-panel-${active.value}`}\n          role=\"tabpanel\"\n          aria-labelledby={`${id}-tab-${active.value}`}\n          tabIndex={0}\n          initial={reduceMotion ? false : { opacity: 0, y: 6 }}\n          animate={{ opacity: 1, y: 0 }}\n          transition={{ duration: 0.2 }}\n          className=\"pt-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50\"\n        >\n          {active.content}\n        </motion.div>\n      ) : null}\n    </div>\n  )\n}\n\nexport { AnimatedTabs, type AnimatedTab, type AnimatedTabsProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.1"
  },
  "categories": [
    "navigation",
    "animations"
  ],
  "type": "registry:ui"
}