{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "user-menu",
  "title": "User menu",
  "description": "The signed-in person behind their avatar: who they are, their account, their workspaces, the theme and signing out. A Menu that opens as a bottom sheet on a phone, with submenus and radio groups for any layout.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/menu.json",
    "https://kinoui.com/r/theme-switcher.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/user-menu.tsx",
      "content": "'use client'\n\nimport {\n  Menu,\n  MenuContent,\n  MenuGroup,\n  MenuGroupLabel,\n  MenuItem,\n  MenuItemIcon,\n  MenuRadioGroup,\n  MenuRadioItem,\n  MenuSeparator,\n  MenuSub,\n  MenuSubContent,\n  MenuSubTrigger,\n  MenuTrigger,\n} from '@/registry/components/kino/menu'\nimport {\n  type ThemeCrossover,\n  ThemeMenuRadioGroup,\n} from '@/registry/components/kino/theme-switcher'\nimport type { ComponentProps, CSSProperties, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * The signed-in person's menu, behind their avatar: who they are, their\n * account, the workspace they're in, the theme and signing out. Built on the\n * Menu, so it grows from its trigger and one highlight glides between its\n * rows; on a phone it opens as a bottom sheet (`presentation='auto'`), where\n * a submenu opens in the menu's place.\n *\n * Every choice sits at the top level, one press away: the workspaces as\n * rows with their logos, and the theme as three icons in one row. Submenus,\n * labels and radio groups build any other layout, such as the workspaces\n * and the theme each in a submenu.\n */\n\n/** Pass `open` and `onOpenChange` to control it; `presentation='popover'` keeps it a popover on a phone too. */\nfunction UserMenu({ presentation = 'auto', ...props }: ComponentProps<typeof Menu>) {\n  return <Menu presentation={presentation} {...props} />\n}\n\n/** What opens it, such as an avatar in a ghost Button or a Sidebar's row, through `render`. */\nfunction UserMenuTrigger(props: ComponentProps<typeof MenuTrigger>) {\n  return <MenuTrigger {...props} />\n}\n\n/** It opens under the trigger's end edge. */\nfunction UserMenuContent({\n  align = 'end',\n  className,\n  style,\n  ...props\n}: ComponentProps<typeof MenuContent>) {\n  return (\n    <MenuContent\n      data-user-menu-content=''\n      align={align}\n      // Who they are, their workspaces and the theme hold more than a menu's 24rem.\n      style={(state) => ({\n        '--menu-max-height': '36rem',\n        ...((typeof style === 'function' ? style(state) : style) as CSSProperties),\n      })}\n      className={cn('min-w-60', className)}\n      {...props}\n    />\n  )\n}\n\n/** Who is signed in: their avatar, their name, which names the group, and their email. */\nfunction UserMenuHeader({\n  name,\n  email,\n  avatar,\n  className,\n}: {\n  name: ReactNode\n  email?: ReactNode\n  /** Their Avatar, at `sm`. */\n  avatar?: ReactNode\n  className?: string\n}) {\n  return (\n    <MenuGroup\n      data-user-menu-header=''\n      className={cn(\n        'flex flex-row items-center gap-2.5 px-(--control-padding) py-2',\n        className,\n      )}\n    >\n      {avatar}\n      <span className='flex min-w-0 flex-1 flex-col'>\n        {/* A long name or email wraps, so the whole of it shows. */}\n        <MenuGroupLabel className='text-foreground p-0 text-sm font-medium wrap-break-word'>\n          {name}\n        </MenuGroupLabel>\n        {email ? (\n          <span className='text-muted-foreground text-xs wrap-anywhere'>{email}</span>\n        ) : null}\n      </span>\n    </MenuGroup>\n  )\n}\n\n/**\n * The workspaces under a heading, the one they're in marked. Switching\n * workspace changes the page, so a pick closes the menu. `label={null}`\n * leaves the heading out, as in a submenu, with an `aria-label` in its place.\n */\nfunction UserMenuWorkspaces<Value extends string = string>({\n  label = 'Workspaces',\n  children,\n  ...props\n}: Omit<ComponentProps<typeof MenuRadioGroup<Value>>, 'children'> & {\n  label?: ReactNode\n  children: ReactNode\n}) {\n  return (\n    <MenuRadioGroup<Value> data-user-menu-workspaces='' {...props}>\n      {label === null ? null : (\n        // At the start, over the logos, as the theme's heading is: not past a tick's gutter, since its rows have none.\n        <MenuGroupLabel className='ps-(--control-padding)'>{label}</MenuGroupLabel>\n      )}\n      {children}\n    </MenuRadioGroup>\n  )\n}\n\n/** One workspace: its logo, its name, and a line such as its plan. Picking one closes the menu. */\nfunction UserMenuWorkspace({\n  logo,\n  description,\n  children,\n  label = typeof children === 'string' ? children : undefined,\n  closeOnSelect = true,\n  ...props\n}: Omit<ComponentProps<typeof MenuRadioItem>, 'children'> & {\n  /** Its logo, sized to the row's icons. */\n  logo?: ReactNode\n  /** Read after the name, such as \"Team plan\". */\n  description?: ReactNode\n  children: ReactNode\n}) {\n  return (\n    <MenuRadioItem\n      data-user-menu-workspace=''\n      label={label}\n      closeOnSelect={closeOnSelect}\n      {...props}\n    >\n      {logo}\n      {/* Whole, never cut short: the menu is where a long name is read in full. */}\n      <span className='min-w-0 flex-1 break-words'>{children}</span>\n      {/* A screen reader hears the plan as a word of its own. */}\n      {description ? ' ' : null}\n      {description ? (\n        <span className='text-muted-foreground in-data-highlighted:text-accent-foreground/80 shrink-0 text-xs'>\n          {description}\n        </span>\n      ) : null}\n    </MenuRadioItem>\n  )\n}\n\n/**\n * System, light and dark: one row, the three as icons beside `label`, or\n * with `inline={false}` three rows, for a submenu.\n */\nfunction UserMenuTheme({\n  label = 'Theme',\n  inline = true,\n  crossover = 'fade',\n}: {\n  /** Names the choice: beside the icons, or for a screen reader. */\n  label?: string\n  /** One row of icons; `false` for three rows with their names. */\n  inline?: boolean\n  /** How the page crosses over to the new theme. */\n  crossover?: ThemeCrossover\n}) {\n  if (!inline) {\n    return <ThemeMenuRadioGroup label={null} aria-label={label} crossover={crossover} />\n  }\n  return <ThemeMenuRadioGroup inline label={label} crossover={crossover} />\n}\n\nfunction UserMenuGroup(props: ComponentProps<typeof MenuGroup>) {\n  return <MenuGroup {...props} />\n}\n\nfunction UserMenuItem(props: ComponentProps<typeof MenuItem>) {\n  return <MenuItem {...props} />\n}\n\nfunction UserMenuItemIcon(props: ComponentProps<typeof MenuItemIcon>) {\n  return <MenuItemIcon {...props} />\n}\n\n/** A group's heading, which names it. */\nfunction UserMenuLabel(props: ComponentProps<typeof MenuGroupLabel>) {\n  return <MenuGroupLabel {...props} />\n}\n\n/** One choice of several of your own, such as a status, under a `UserMenuLabel`. */\nfunction UserMenuRadioGroup<Value extends string = string>(\n  props: ComponentProps<typeof MenuRadioGroup<Value>>,\n) {\n  return <MenuRadioGroup<Value> {...props} />\n}\n\nfunction UserMenuRadioItem(props: ComponentProps<typeof MenuRadioItem>) {\n  return <MenuRadioItem {...props} />\n}\n\n/** A row that opens more rows beside it; in the sheet they open in the menu's place. */\nfunction UserMenuSub(props: ComponentProps<typeof MenuSub>) {\n  return <MenuSub {...props} />\n}\n\n/** The row that opens a submenu, such as one that names the workspace they're in. */\nfunction UserMenuSubTrigger(props: ComponentProps<typeof MenuSubTrigger>) {\n  return <MenuSubTrigger {...props} />\n}\n\nfunction UserMenuSubContent(props: ComponentProps<typeof MenuSubContent>) {\n  return <MenuSubContent {...props} />\n}\n\nfunction UserMenuSeparator(props: ComponentProps<typeof MenuSeparator>) {\n  return <MenuSeparator {...props} />\n}\n\nexport {\n  UserMenu,\n  UserMenuContent,\n  UserMenuGroup,\n  UserMenuHeader,\n  UserMenuItem,\n  UserMenuItemIcon,\n  UserMenuLabel,\n  UserMenuRadioGroup,\n  UserMenuRadioItem,\n  UserMenuSeparator,\n  UserMenuSub,\n  UserMenuSubContent,\n  UserMenuSubTrigger,\n  UserMenuTheme,\n  UserMenuTrigger,\n  UserMenuWorkspace,\n  UserMenuWorkspaces,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/user-menu.tsx"
    }
  ],
  "type": "registry:component"
}