{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kbd",
  "title": "Kbd",
  "description": "A key in the Code voice: a key cell with a 2px floor; KbdGroup joins a chord's keys on seams (nested kbd), with the separator read, not drawn. Used by Command.",
  "dependencies": [
    "@base-ui/react@1.9.0"
  ],
  "registryDependencies": [
    "@keyline-ui/keyline",
    "@keyline-ui/keyline-render",
    "utils"
  ],
  "files": [
    {
      "path": "src/registry/keyline/ui/kbd.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\n\nimport { cn } from \"@/lib/utils\";\nimport { resolveClassName, resolveStyle, type PartProps } from \"../lib/keyline-render\";\n\n/*\n * A key cell in the Code voice: a 1px keyline with a 2px floor (the key's lip). Inline-grid, so it sits on the text\n * baseline of the prose around it, and its 22px box takes only 16px of the line (-3px block margins): a key never\n * opens up the line it sits in. It takes its colour from its context: ink in prose, on-inverse on a highlighted row.\n */\nconst key = cn(\n  \"m-0 -my-[3px] box-border inline-grid h-[22px] min-w-[22px] place-items-center px-[5px]\",\n  \"border-(length:--kl-k1) border-b-2 border-current bg-transparent text-inherit\",\n  \"font-(family-name:--kl-font-mono) text-(length:--kl-text-code)/none font-medium tracking-normal not-italic normal-nums\",\n  \"whitespace-nowrap normal-case forced-colors:border-[CanvasText]\",\n);\n\n/*\n * A chord: one key frame, its keys on seams. The group owns the keys' frame, so its rules key on their slot. Key\n * names are a left-to-right unit in any page direction (Ctrl then K), like a code.\n */\nconst group = cn(\n  \"m-0 -my-[3px] box-border inline-flex h-[22px] items-stretch\",\n  \"border-(length:--kl-k1) border-b-2 border-current bg-transparent text-inherit\",\n  \"whitespace-nowrap [direction:ltr] [unicode-bidi:isolate] forced-colors:border-[CanvasText]\",\n  \"*:data-[slot=kbd]:m-0 *:data-[slot=kbd]:h-auto *:data-[slot=kbd]:min-w-[20px] *:data-[slot=kbd]:border-0\",\n  \"*:data-[slot=kbd]:not-first:border-s-(length:--kl-k1) *:data-[slot=kbd]:not-first:border-s-kl-seam\",\n);\n\ntype KbdState = Record<string, never>;\nconst STATE: KbdState = {};\n\ntype KbdProps = PartProps<\"kbd\", KbdState> & {\n  /** Words for a symbol key (\"Command\" for ⌘, \"Shift\" for ⇧): the glyph shows, the words are read. */\n  label?: string;\n};\n\n/**\n * A key, in the Code voice. A small key cell: a 1px keyline with a 2px floor, the key's lip.\n * Used in prose and help text, and by Command, Menu and Tooltip for their shortcuts.\n */\nfunction Kbd({ label, render, className, style, children, ...props }: KbdProps): React.ReactElement {\n  const own = {\n    \"data-slot\": \"kbd\",\n    className: resolveClassName(key, className)(STATE),\n    style: resolveStyle(undefined, style)(STATE),\n    children: label ? (\n      <>\n        <span aria-hidden>{children}</span>\n        <span className=\"kl-sr\">{label}</span>\n      </>\n    ) : (\n      children\n    ),\n  };\n  return useRender({ defaultTagName: \"kbd\", render, state: STATE, props: mergeProps<\"kbd\">(props, own) });\n}\n\ntype KbdGroupProps = PartProps<\"kbd\", KbdState> & {\n  /** Read between keys (the seam shows it): \"+\" for a chord, \"then\" for a sequence. */\n  separator?: string;\n};\n\n/**\n * Keys pressed together (or in order) as cells of one key frame on shared seams (C1), nested <kbd> as\n * HTML specifies for a combination. The separator is read, not drawn: the seam is the join.\n */\nfunction KbdGroup({\n  separator = \"+\",\n  render,\n  className,\n  style,\n  children,\n  ...props\n}: KbdGroupProps): React.ReactElement {\n  const keys = React.Children.toArray(children);\n  const own = {\n    \"data-slot\": \"kbd-group\",\n    className: resolveClassName(group, className)(STATE),\n    style: resolveStyle(undefined, style)(STATE),\n    children: keys.map((k, i) => (\n      <React.Fragment key={i}>\n        {i > 0 ? <span className=\"kl-sr\"> {separator} </span> : null}\n        {k}\n      </React.Fragment>\n    )),\n  };\n  return useRender({ defaultTagName: \"kbd\", render, state: STATE, props: mergeProps<\"kbd\">(props, own) });\n}\n\nexport { Kbd, KbdGroup, type KbdProps, type KbdGroupProps };\n",
      "type": "registry:ui",
      "target": "components/keyline/ui/kbd.tsx"
    }
  ],
  "type": "registry:ui"
}