{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "menubar",
  "title": "Menubar",
  "description": "The row of menus desktop tools are built on, with sub menus, check and radio items, shortcuts and full arrow key movement across the bar.",
  "dependencies": [
    "lucide-react",
    "radix-ui"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/miseui/ui/menubar.tsx",
      "content": "import type * as React from \"react\"\nimport { createContext, useContext, useMemo } from \"react\"\nimport { Menubar as MenubarPrimitive } from \"radix-ui\"\nimport {\n  BAR_CLASS,\n  MATERIALIZE_CLASS,\n  PANEL_CLASS,\n  PLAIN_MOTION_CLASS,\n  TRIGGER_BASE_CLASS,\n  TRIGGER_CLASS,\n  type MenubarEffect,\n  type MenubarVariant,\n} from \"@/registry/miseui/ui/menubar-classes\"\nimport {\n  MenubarCheckboxItem,\n  MenubarItem,\n  MenubarLabel,\n  MenubarRadioGroup,\n  MenubarRadioItem,\n  MenubarSeparator,\n  MenubarShortcut,\n  MenubarSubTrigger,\n  type MenubarItemProps,\n} from \"@/registry/miseui/ui/menubar-items\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\nconst MenubarContext = createContext<{ variant: MenubarVariant; effect?: MenubarEffect }>({ variant: \"plain\" })\n\nconst SIDE_OFFSET_PX = 4\nconst SUB_SIDE_OFFSET_PX = 4\n/** Keeps menus off the screen edge on a phone. */\nconst COLLISION_PADDING_PX = 8\n\ntype MenubarProps = Omit<React.ComponentProps<typeof MenubarPrimitive.Root>, \"title\"> & {\n  /** `plain` a bordered bar, `ghost` words only, `pill` a rounded track, `app` a document title above its menus. */\n  variant?: MenubarVariant\n  /** `materialize` brings menus into focus from the trigger they belong to. */\n  effect?: MenubarEffect\n  /** The document name in the title row of `app`. */\n  title?: React.ReactNode\n  /** Right side of the title row of `app`, such as a share button. */\n  actions?: React.ReactNode\n}\n\nfunction Menubar({ variant = \"plain\", effect, title, actions, className, ...props }: MenubarProps) {\n  const context = useMemo(() => ({ variant, effect }), [variant, effect])\n  const bar = (\n    <MenubarPrimitive.Root\n      data-slot=\"menubar\"\n      data-variant={variant}\n      data-effect={effect}\n      className={cn(BAR_CLASS[variant], variant !== \"app\" && className)}\n      {...props}\n    />\n  )\n  return (\n    <MenubarContext.Provider value={context}>\n      {variant === \"app\" ? (\n        <div data-slot=\"menubar-window\" className={cn(\"grid min-w-0 gap-1 border-b pt-2 pb-1\", className)}>\n          <div data-slot=\"menubar-title\" className=\"flex min-w-0 flex-wrap items-center justify-between gap-2 px-3\">\n            <div className=\"min-w-0 text-[15px] leading-6 font-medium wrap-anywhere\">{title}</div>\n            {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n          </div>\n          {bar}\n        </div>\n      ) : (\n        bar\n      )}\n    </MenubarContext.Provider>\n  )\n}\n\nfunction MenubarMenu(props: React.ComponentProps<typeof MenubarPrimitive.Menu>) {\n  return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />\n}\n\nfunction MenubarTrigger({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {\n  const { variant } = useContext(MenubarContext)\n  return <MenubarPrimitive.Trigger data-slot=\"menubar-trigger\" className={cn(TRIGGER_BASE_CLASS, TRIGGER_CLASS[variant], className)} {...props} />\n}\n\nfunction motionClass(effect: MenubarEffect | undefined) {\n  return effect === \"materialize\" ? MATERIALIZE_CLASS : PLAIN_MOTION_CLASS\n}\n\nfunction MenubarContent({\n  className,\n  align = \"start\",\n  sideOffset = SIDE_OFFSET_PX,\n  collisionPadding = COLLISION_PADDING_PX,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Content>) {\n  const { effect } = useContext(MenubarContext)\n  return (\n    <MenubarPrimitive.Portal>\n      <MenubarPrimitive.Content\n        data-slot=\"menubar-content\"\n        data-effect={effect}\n        align={align}\n        sideOffset={sideOffset}\n        collisionPadding={collisionPadding}\n        className={cn(PANEL_CLASS, motionClass(effect), className)}\n        {...props}\n      />\n    </MenubarPrimitive.Portal>\n  )\n}\n\nfunction MenubarGroup(props: React.ComponentProps<typeof MenubarPrimitive.Group>) {\n  return <MenubarPrimitive.Group data-slot=\"menubar-group\" {...props} />\n}\n\nfunction MenubarSub(props: React.ComponentProps<typeof MenubarPrimitive.Sub>) {\n  return <MenubarPrimitive.Sub data-slot=\"menubar-sub\" {...props} />\n}\n\nfunction MenubarSubContent({\n  className,\n  sideOffset = SUB_SIDE_OFFSET_PX,\n  collisionPadding = COLLISION_PADDING_PX,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {\n  const { effect } = useContext(MenubarContext)\n  return (\n    <MenubarPrimitive.Portal>\n      <MenubarPrimitive.SubContent\n        data-slot=\"menubar-sub-content\"\n        data-effect={effect}\n        sideOffset={sideOffset}\n        collisionPadding={collisionPadding}\n        className={cn(PANEL_CLASS, motionClass(effect), className)}\n        {...props}\n      />\n    </MenubarPrimitive.Portal>\n  )\n}\n\nexport {\n  Menubar,\n  MenubarMenu,\n  MenubarTrigger,\n  MenubarContent,\n  MenubarItem,\n  MenubarCheckboxItem,\n  MenubarRadioGroup,\n  MenubarRadioItem,\n  MenubarLabel,\n  MenubarSeparator,\n  MenubarShortcut,\n  MenubarGroup,\n  MenubarSub,\n  MenubarSubTrigger,\n  MenubarSubContent,\n  type MenubarProps,\n  type MenubarItemProps,\n  type MenubarVariant,\n  type MenubarEffect,\n}\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/miseui/ui/menubar-classes.ts",
      "content": "type MenubarVariant = \"plain\" | \"ghost\" | \"pill\" | \"app\"\ntype MenubarEffect = \"materialize\"\n\nconst BAR_CLASS: Record<MenubarVariant, string> = {\n  plain: \"flex flex-wrap items-center gap-1 rounded-md border bg-background p-1 shadow-xs\",\n  ghost: \"flex flex-wrap items-center gap-1\",\n  pill: \"flex flex-wrap items-center gap-1 rounded-[20px] bg-muted p-1\",\n  app: \"flex flex-wrap items-center gap-1 px-1\",\n}\n\nconst TRIGGER_BASE_CLASS = [\n  \"inline-flex h-8 items-center gap-1 px-3 text-sm font-medium outline-none select-none pointer-coarse:h-10\",\n  \"transition-[color,background-color,box-shadow] duration-(--duration-fast) ease-(--ease-mise)\",\n  \"focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\",\n]\n\nconst TRIGGER_CLASS: Record<MenubarVariant, string> = {\n  plain: \"rounded-sm hover:bg-accent focus:bg-accent data-[state=open]:bg-accent\",\n  // Nothing is drawn until a menu opens, so the words alone have to say they can be pressed.\n  ghost: \"rounded-sm text-muted-foreground hover:text-foreground focus:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground\",\n  pill: \"rounded-full text-muted-foreground hover:text-foreground focus:text-foreground data-[state=open]:bg-background data-[state=open]:text-foreground data-[state=open]:shadow-xs\",\n  app: \"h-7 rounded-sm px-2 text-[13px] font-normal hover:bg-accent focus:bg-accent data-[state=open]:bg-accent pointer-coarse:h-10\",\n}\n\n/**\n * Menus only animate in. While one is still animating out, Radix closes the next menu that the arrow keys\n * just opened, and moving along the bar stops working in a real browser. jsdom has no animations and passes.\n */\nconst PLAIN_MOTION_CLASS = [\n  \"duration-(--duration-fast) ease-(--ease-mise)\",\n  \"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n]\n\n/** The enter values stay unqualified so the media overrides below win on source order. */\nconst MATERIALIZE_CLASS = [\n  \"duration-(--duration-base) ease-(--ease-mise-out) will-change-[transform,opacity,filter]\",\n  \"data-[state=open]:animate-in\",\n  \"fade-in-0 zoom-in-90 blur-in-sm\",\n  \"motion-reduce:zoom-in-100 motion-reduce:blur-in-0\",\n  \"[@media(prefers-reduced-transparency:reduce)]:blur-in-0\",\n]\n\nconst PANEL_CLASS = [\n  \"z-50 min-w-48 max-w-[calc(100vw-1rem)] overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n  \"max-h-(--radix-menubar-content-available-height) origin-(--radix-menubar-content-transform-origin)\",\n]\n\nconst ITEM_CLASS = [\n  \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none pointer-coarse:py-2.5\",\n  \"transition-[color,background-color] duration-(--duration-fast) ease-(--ease-mise)\",\n  \"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n  \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n]\n\nconst DESTRUCTIVE_ITEM_CLASS = \"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20\"\n\n/** Check and radio rows keep a fixed slot on the left, so labels line up whether or not they are selected. */\nconst INDICATOR_ITEM_CLASS = \"pl-8\"\n\nexport {\n  BAR_CLASS,\n  DESTRUCTIVE_ITEM_CLASS,\n  INDICATOR_ITEM_CLASS,\n  ITEM_CLASS,\n  MATERIALIZE_CLASS,\n  PANEL_CLASS,\n  PLAIN_MOTION_CLASS,\n  TRIGGER_BASE_CLASS,\n  TRIGGER_CLASS,\n  type MenubarEffect,\n  type MenubarVariant,\n}\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/miseui/ui/menubar-items.tsx",
      "content": "import type * as React from \"react\"\nimport { Menubar as MenubarPrimitive } from \"radix-ui\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\nimport { DESTRUCTIVE_ITEM_CLASS, INDICATOR_ITEM_CLASS, ITEM_CLASS } from \"@/registry/miseui/ui/menubar-classes\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\ntype MenubarItemProps = React.ComponentProps<typeof MenubarPrimitive.Item> & {\n  /** Destructive items read in the destructive colour so the eye slows down before clicking. */\n  variant?: \"default\" | \"destructive\"\n}\n\nfunction MenubarItem({ className, variant = \"default\", ...props }: MenubarItemProps) {\n  return (\n    <MenubarPrimitive.Item\n      data-slot=\"menubar-item\"\n      data-variant={variant}\n      className={cn(ITEM_CLASS, variant === \"destructive\" && DESTRUCTIVE_ITEM_CLASS, className)}\n      {...props}\n    />\n  )\n}\n\nfunction Indicator({ children }: { children: React.ReactNode }) {\n  return (\n    <span className=\"pointer-events-none absolute left-2 flex size-4 items-center justify-center\">\n      <MenubarPrimitive.ItemIndicator>{children}</MenubarPrimitive.ItemIndicator>\n    </span>\n  )\n}\n\nfunction MenubarCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {\n  return (\n    <MenubarPrimitive.CheckboxItem data-slot=\"menubar-checkbox-item\" className={cn(ITEM_CLASS, INDICATOR_ITEM_CLASS, className)} {...props}>\n      <Indicator>\n        <Check aria-hidden=\"true\" />\n      </Indicator>\n      {children}\n    </MenubarPrimitive.CheckboxItem>\n  )\n}\n\nfunction MenubarRadioGroup(props: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {\n  return <MenubarPrimitive.RadioGroup data-slot=\"menubar-radio-group\" {...props} />\n}\n\nfunction MenubarRadioItem({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {\n  return (\n    <MenubarPrimitive.RadioItem data-slot=\"menubar-radio-item\" className={cn(ITEM_CLASS, INDICATOR_ITEM_CLASS, className)} {...props}>\n      <Indicator>\n        <Circle aria-hidden=\"true\" className=\"size-2 fill-current\" />\n      </Indicator>\n      {children}\n    </MenubarPrimitive.RadioItem>\n  )\n}\n\nfunction MenubarLabel({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Label>) {\n  return <MenubarPrimitive.Label data-slot=\"menubar-label\" className={cn(\"px-2 py-1.5 text-[13px] text-muted-foreground\", className)} {...props} />\n}\n\nfunction MenubarSeparator({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Separator>) {\n  return <MenubarPrimitive.Separator data-slot=\"menubar-separator\" className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />\n}\n\n/** On touch there is no keyboard to press it with, so the hint would only take room from the label. */\nfunction MenubarShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n  return <span data-slot=\"menubar-shortcut\" className={cn(\"ml-auto pl-4 text-xs text-muted-foreground tabular-nums pointer-coarse:hidden\", className)} {...props} />\n}\n\nfunction MenubarSubTrigger({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger>) {\n  return (\n    <MenubarPrimitive.SubTrigger data-slot=\"menubar-sub-trigger\" className={cn(ITEM_CLASS, \"data-[state=open]:bg-accent\", className)} {...props}>\n      {children}\n      <ChevronRight aria-hidden=\"true\" className=\"ml-auto text-muted-foreground\" />\n    </MenubarPrimitive.SubTrigger>\n  )\n}\n\nexport {\n  MenubarCheckboxItem,\n  MenubarItem,\n  MenubarLabel,\n  MenubarRadioGroup,\n  MenubarRadioItem,\n  MenubarSeparator,\n  MenubarShortcut,\n  MenubarSubTrigger,\n  type MenubarItemProps,\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "navigation"
  ],
  "type": "registry:ui"
}