{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "radix-dropdown-menu",
  "title": "Radix Dropdown Menu",
  "description": "An accessible dropdown menu built on Radix UI with smooth Motion spring scale and submenu slide animations.",
  "dependencies": ["radix-ui", "motion", "lucide-react"],
  "registryDependencies": ["utils", "@soralabs/hooks-use-controlled-state"],
  "files": [
    {
      "path": "registry/ui/radix/dropdown-menu/index.tsx",
      "content": "\"use client\";\n\nimport { useControlledState } from \"@/hooks/use-controlled-state\";\nimport { cn } from \"@/lib/utils\";\nimport { CheckIcon, ChevronRightIcon } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Direction, DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport type { ComponentProps } from \"react\";\n\ninterface DropdownMenuContextValue {\n  open: boolean;\n  setOpen: (open: boolean) => void;\n}\n\nconst DropdownMenuContext = createContext<DropdownMenuContextValue | null>(\n  null\n);\n\nfunction useDropdownMenuContext() {\n  return useContext(DropdownMenuContext);\n}\n\ninterface DropdownMenuSubContextValue {\n  open: boolean;\n  setOpen: (open: boolean) => void;\n}\n\nconst DropdownMenuSubContext =\n  createContext<DropdownMenuSubContextValue | null>(null);\n\nfunction useDropdownMenuSubContext() {\n  return useContext(DropdownMenuSubContext);\n}\n\ntype DropdownMenuProps = ComponentProps<typeof DropdownMenuPrimitive.Root>;\n\n/**\n * Root container for the Dropdown Menu component powered by Radix UI and Motion.\n */\nfunction DropdownMenu({\n  open: controlledOpen,\n  defaultOpen = false,\n  onOpenChange,\n  children,\n  ...props\n}: DropdownMenuProps) {\n  const [open, setOpen] = useControlledState({\n    defaultValue: defaultOpen,\n    onChange: onOpenChange,\n    value: controlledOpen,\n  });\n\n  const contextValue = useMemo(\n    () => ({ open: Boolean(open), setOpen }),\n    [open, setOpen]\n  );\n\n  return (\n    <DropdownMenuContext.Provider value={contextValue}>\n      <DropdownMenuPrimitive.Root\n        data-slot=\"dropdown-menu\"\n        onOpenChange={(nextOpen) => {\n          setOpen(nextOpen);\n        }}\n        open={open}\n        {...props}\n      >\n        {children}\n      </DropdownMenuPrimitive.Root>\n    </DropdownMenuContext.Provider>\n  );\n}\n\ntype DropdownMenuPortalProps = ComponentProps<\n  typeof DropdownMenuPrimitive.Portal\n>;\n\n/**\n * Portals the dropdown menu content into the document body.\n */\nfunction DropdownMenuPortal({ ...props }: DropdownMenuPortalProps) {\n  return (\n    <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n  );\n}\n\ntype DropdownMenuTriggerProps = ComponentProps<\n  typeof DropdownMenuPrimitive.Trigger\n>;\n\n/**\n * The button or element that opens the dropdown menu on click.\n */\nfunction DropdownMenuTrigger({\n  asChild,\n  className,\n  ...props\n}: DropdownMenuTriggerProps) {\n  return (\n    <DropdownMenuPrimitive.Trigger\n      asChild={asChild}\n      className={className}\n      data-slot=\"dropdown-menu-trigger\"\n      {...props}\n    />\n  );\n}\n\ninterface DropdownMenuContentProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.Content\n> {\n  /**\n   * Whether to disable Motion spring physics and animations.\n   * @default false\n   */\n  disableAnimation?: boolean;\n}\n\n/**\n * Dropdown menu popup container with smooth Motion spring scale and opacity\n * entrance/exit animations.\n */\nfunction DropdownMenuContent({\n  className,\n  align = \"start\",\n  alignOffset = 0,\n  side = \"bottom\",\n  sideOffset = 4,\n  collisionPadding = 8,\n  disableAnimation = false,\n  children,\n  asChild: _asChild,\n  style,\n  ...props\n}: DropdownMenuContentProps) {\n  const context = useDropdownMenuContext();\n  const prefersReducedMotion = useReducedMotion();\n  const isOpen = context ? context.open : true;\n  const shouldAnimate = !(disableAnimation || prefersReducedMotion);\n\n  return (\n    <AnimatePresence>\n      {isOpen && (\n        <DropdownMenuPrimitive.Portal forceMount>\n          <DropdownMenuPrimitive.Content\n            align={align}\n            alignOffset={alignOffset}\n            asChild\n            className={cn(\n              \"border-border bg-popover/95 text-popover-foreground ring-foreground/5 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-44 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border p-1 shadow-xl ring-1 backdrop-blur-md outline-none\",\n              className\n            )}\n            collisionPadding={collisionPadding}\n            data-slot=\"dropdown-menu-content\"\n            forceMount\n            side={side}\n            sideOffset={sideOffset}\n            {...props}\n          >\n            <motion.div\n              animate={{ opacity: 1, scale: 1 }}\n              exit={\n                shouldAnimate\n                  ? {\n                      opacity: 0,\n                      scale: 0.95,\n                      transition: {\n                        duration: 0.1,\n                      },\n                    }\n                  : { opacity: 0 }\n              }\n              initial={\n                shouldAnimate ? { opacity: 0, scale: 0.95 } : { opacity: 0 }\n              }\n              style={{\n                transformOrigin:\n                  \"var(--radix-dropdown-menu-content-transform-origin, var(--transform-origin))\",\n                ...style,\n              }}\n              transition={\n                shouldAnimate\n                  ? {\n                      type: \"spring\",\n                      stiffness: 400,\n                      damping: 24,\n                      opacity: { duration: 0.18 },\n                    }\n                  : { duration: 0 }\n              }\n            >\n              {children}\n            </motion.div>\n          </DropdownMenuPrimitive.Content>\n        </DropdownMenuPrimitive.Portal>\n      )}\n    </AnimatePresence>\n  );\n}\n\ntype DropdownMenuGroupProps = ComponentProps<\n  typeof DropdownMenuPrimitive.Group\n>;\n\n/**\n * Groups related dropdown menu items together.\n */\nfunction DropdownMenuGroup({ ...props }: DropdownMenuGroupProps) {\n  return (\n    <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n  );\n}\n\ninterface DropdownMenuLabelProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.Label\n> {\n  /**\n   * Whether to indent the label for alignment with checkable items.\n   * @default false\n   */\n  inset?: boolean;\n}\n\n/**\n * Section label for a group of dropdown menu items.\n * Must be used inside `<DropdownMenuGroup>` or `<DropdownMenuRadioGroup>`.\n */\nfunction DropdownMenuLabel({\n  className,\n  inset,\n  ...props\n}: DropdownMenuLabelProps) {\n  return (\n    <DropdownMenuPrimitive.Label\n      className={cn(\n        \"text-muted-foreground px-2 py-1.5 text-xs font-semibold data-inset:pl-8\",\n        className\n      )}\n      data-inset={inset}\n      data-slot=\"dropdown-menu-label\"\n      {...props}\n    />\n  );\n}\n\ninterface DropdownMenuItemProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.Item\n> {\n  /**\n   * Whether to indent the item for alignment with checkable items.\n   * @default false\n   */\n  inset?: boolean;\n  /**\n   * Visual style variant of the item.\n   * @default \"default\"\n   */\n  variant?: \"default\" | \"destructive\";\n}\n\n/**\n * An actionable item within the dropdown menu.\n */\nfunction DropdownMenuItem({\n  className,\n  inset,\n  variant = \"default\",\n  ...props\n}: DropdownMenuItemProps) {\n  return (\n    <DropdownMenuPrimitive.Item\n      className={cn(\n        \"group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive data-highlighted:bg-accent data-[variant=destructive]:text-destructive data-highlighted:text-accent-foreground data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 dark:data-[variant=destructive]:focus:bg-destructive/20 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive data-highlighted:*:[svg]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 rtl:data-inset:pr-8 rtl:data-inset:pl-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      data-inset={inset}\n      data-slot=\"dropdown-menu-item\"\n      data-variant={variant}\n      {...props}\n    />\n  );\n}\n\ntype DropdownMenuSubProps = ComponentProps<typeof DropdownMenuPrimitive.Sub>;\n\n/**\n * Submenu root container managing nested submenu state.\n */\nfunction DropdownMenuSub({\n  open: controlledOpen,\n  defaultOpen = false,\n  onOpenChange,\n  children,\n  ...props\n}: DropdownMenuSubProps) {\n  const [open, setOpen] = useControlledState({\n    defaultValue: defaultOpen,\n    onChange: onOpenChange,\n    value: controlledOpen,\n  });\n\n  const contextValue = useMemo(\n    () => ({ open: Boolean(open), setOpen }),\n    [open, setOpen]\n  );\n\n  return (\n    <DropdownMenuSubContext.Provider value={contextValue}>\n      <DropdownMenuPrimitive.Sub\n        data-slot=\"dropdown-menu-sub\"\n        onOpenChange={(nextOpen) => {\n          setOpen(nextOpen);\n        }}\n        open={open}\n        {...props}\n      >\n        {children}\n      </DropdownMenuPrimitive.Sub>\n    </DropdownMenuSubContext.Provider>\n  );\n}\n\ninterface DropdownMenuSubTriggerProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.SubTrigger\n> {\n  /**\n   * Whether to indent the item for alignment with checkable items.\n   * @default false\n   */\n  inset?: boolean;\n}\n\n/**\n * Interactive menu item that reveals a submenu on hover or click.\n */\nfunction DropdownMenuSubTrigger({\n  className,\n  inset,\n  children,\n  ...props\n}: DropdownMenuSubTriggerProps) {\n  return (\n    <DropdownMenuPrimitive.SubTrigger\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-highlighted:bg-accent data-open:bg-accent data-popup-open:bg-accent data-[state=open]:text-accent-foreground data-highlighted:text-accent-foreground data-open:text-accent-foreground data-popup-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 rtl:data-inset:pr-8 rtl:data-inset:pl-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      data-inset={inset}\n      data-slot=\"dropdown-menu-sub-trigger\"\n      {...props}\n    >\n      {children}\n      <ChevronRightIcon className=\"text-muted-foreground ms-auto size-4 rtl:rotate-180\" />\n    </DropdownMenuPrimitive.SubTrigger>\n  );\n}\n\ninterface DropdownMenuSubContentProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.SubContent\n> {\n  /**\n   * Whether to disable Motion transitions and animations.\n   * @default false\n   */\n  disableAnimation?: boolean;\n}\n\n/**\n * Submenu popup content with smooth Motion spring slide entrance and exit animations.\n */\nfunction DropdownMenuSubContent({\n  className,\n  alignOffset = -4,\n  sideOffset = 0,\n  collisionPadding = 8,\n  disableAnimation = false,\n  children,\n  asChild: _asChild,\n  style,\n  ...props\n}: DropdownMenuSubContentProps) {\n  const context = useDropdownMenuSubContext();\n  const direction = Direction.useDirection();\n  const prefersReducedMotion = useReducedMotion();\n  const isOpen = context ? context.open : true;\n  const shouldAnimate = !(disableAnimation || prefersReducedMotion);\n  const slideOffset = direction === \"rtl\" ? 10 : -10;\n\n  return (\n    <AnimatePresence>\n      {isOpen && (\n        <DropdownMenuPrimitive.Portal forceMount>\n          <DropdownMenuPrimitive.SubContent\n            alignOffset={alignOffset}\n            asChild\n            className={cn(\n              \"border-border bg-popover/95 text-popover-foreground ring-foreground/5 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-40 overflow-x-hidden overflow-y-auto rounded-xl border p-1 shadow-2xl ring-1 backdrop-blur-md outline-none\",\n              className\n            )}\n            collisionPadding={collisionPadding}\n            data-slot=\"dropdown-menu-sub-content\"\n            forceMount\n            sideOffset={sideOffset}\n            {...props}\n          >\n            <motion.div\n              animate={{ opacity: 1, x: 0 }}\n              exit={\n                shouldAnimate\n                  ? {\n                      opacity: 0,\n                      x: slideOffset,\n                      transition: {\n                        duration: 0.1,\n                      },\n                    }\n                  : { opacity: 0 }\n              }\n              initial={\n                shouldAnimate ? { opacity: 0, x: slideOffset } : { opacity: 0 }\n              }\n              style={{ ...style }}\n              transition={\n                shouldAnimate\n                  ? {\n                      type: \"spring\",\n                      stiffness: 400,\n                      damping: 20,\n                      opacity: { duration: 0.2 },\n                    }\n                  : { duration: 0 }\n              }\n            >\n              {children}\n            </motion.div>\n          </DropdownMenuPrimitive.SubContent>\n        </DropdownMenuPrimitive.Portal>\n      )}\n    </AnimatePresence>\n  );\n}\n\ninterface DropdownMenuCheckboxItemProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.CheckboxItem\n> {\n  /**\n   * Whether to indent the item for alignment.\n   * @default false\n   */\n  inset?: boolean;\n}\n\n/**\n * An actionable dropdown menu item with a checkbox toggle state.\n */\nfunction DropdownMenuCheckboxItem({\n  className,\n  children,\n  checked,\n  inset,\n  ...props\n}: DropdownMenuCheckboxItemProps) {\n  return (\n    <DropdownMenuPrimitive.CheckboxItem\n      checked={checked}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 rtl:pr-8 rtl:pl-2 rtl:data-inset:pr-8 rtl:data-inset:pl-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      data-inset={inset}\n      data-slot=\"dropdown-menu-checkbox-item\"\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center rtl:right-2 rtl:left-auto\">\n        <DropdownMenuPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </DropdownMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </DropdownMenuPrimitive.CheckboxItem>\n  );\n}\n\ntype DropdownMenuRadioGroupProps = ComponentProps<\n  typeof DropdownMenuPrimitive.RadioGroup\n>;\n\n/**\n * Radio group container for mutually exclusive dropdown menu selections.\n */\nfunction DropdownMenuRadioGroup({ ...props }: DropdownMenuRadioGroupProps) {\n  return (\n    <DropdownMenuPrimitive.RadioGroup\n      data-slot=\"dropdown-menu-radio-group\"\n      {...props}\n    />\n  );\n}\n\ninterface DropdownMenuRadioItemProps extends ComponentProps<\n  typeof DropdownMenuPrimitive.RadioItem\n> {\n  /**\n   * Whether to indent the item for alignment.\n   * @default false\n   */\n  inset?: boolean;\n}\n\n/**\n * A selectable radio option within a DropdownMenuRadioGroup.\n */\nfunction DropdownMenuRadioItem({\n  className,\n  children,\n  inset,\n  ...props\n}: DropdownMenuRadioItemProps) {\n  return (\n    <DropdownMenuPrimitive.RadioItem\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 rtl:pr-8 rtl:pl-2 rtl:data-inset:pr-8 rtl:data-inset:pl-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      data-inset={inset}\n      data-slot=\"dropdown-menu-radio-item\"\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center rtl:right-2 rtl:left-auto\">\n        <DropdownMenuPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </DropdownMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </DropdownMenuPrimitive.RadioItem>\n  );\n}\n\ntype DropdownMenuSeparatorProps = ComponentProps<\n  typeof DropdownMenuPrimitive.Separator\n>;\n\n/**\n * Divider separating groups of dropdown menu items.\n */\nfunction DropdownMenuSeparator({\n  className,\n  ...props\n}: DropdownMenuSeparatorProps) {\n  return (\n    <DropdownMenuPrimitive.Separator\n      className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n      data-slot=\"dropdown-menu-separator\"\n      {...props}\n    />\n  );\n}\n\ntype DropdownMenuShortcutProps = ComponentProps<\"span\">;\n\n/**\n * Renders keyboard shortcut combination hints aligned to the right.\n */\nfunction DropdownMenuShortcut({\n  className,\n  ...props\n}: DropdownMenuShortcutProps) {\n  return (\n    <span\n      className={cn(\n        \"text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest\",\n        className\n      )}\n      data-slot=\"dropdown-menu-shortcut\"\n      {...props}\n    />\n  );\n}\n\nexport type {\n  DropdownMenuCheckboxItemProps,\n  DropdownMenuContentProps,\n  DropdownMenuGroupProps,\n  DropdownMenuItemProps,\n  DropdownMenuLabelProps,\n  DropdownMenuPortalProps,\n  DropdownMenuProps,\n  DropdownMenuRadioGroupProps,\n  DropdownMenuRadioItemProps,\n  DropdownMenuSeparatorProps,\n  DropdownMenuShortcutProps,\n  DropdownMenuSubContentProps,\n  DropdownMenuSubProps,\n  DropdownMenuSubTriggerProps,\n  DropdownMenuTriggerProps,\n};\n\nconst { DirectionProvider } = Direction;\n\nexport {\n  DirectionProvider,\n  DropdownMenu,\n  DropdownMenu as RadixDropdownMenu,\n  DropdownMenu as default,\n  DropdownMenuCheckboxItem,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuPortal,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuShortcut,\n  DropdownMenuSub,\n  DropdownMenuSubContent,\n  DropdownMenuSubTrigger,\n  DropdownMenuTrigger,\n  useDropdownMenuContext,\n  useDropdownMenuSubContext,\n};\n",
      "type": "registry:ui",
      "target": "components/sora-ui/radix/dropdown-menu.tsx"
    }
  ],
  "meta": {
    "agentMetadata": {
      "intent": "Present a compact list of actions or choices from an anchored trigger.",
      "role": "menu",
      "a11yConstraints": [
        "Preserve roving focus, keyboard navigation, and Escape dismissal."
      ],
      "motionEngine": "Motion scale and opacity presence with collision-aware submenu cascades.",
      "compositionRules": ["Use a semantic button as the trigger."],
      "compositionRecipes": ["Compose with radix/button for account actions."]
    }
  },
  "type": "registry:ui"
}
