{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kbd",
  "title": "Kbd",
  "description": "A key or a shortcut, drawn as keys that fit the text around them. Mod is ⌘ on a Mac and Ctrl elsewhere, and each key sinks while it is held.",
  "registryDependencies": [
    "https://kinoui.com/r/keys.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/kbd.tsx",
      "content": "'use client'\n\nimport {\n  type KbdKeyProps,\n  shortcutKeys,\n  useKbdKey,\n  useOrderedKeys,\n} from '@/registry/lib/keys'\nimport type { ComponentProps } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * Each key is drawn as a key, with an edge under it, and sinks into\n * place while the person holds it down. Its colours come from the text it\n * sits in, so it reads the same on a page, a button, a tooltip or a picked row.\n */\n\nfunction Kbd({\n  className,\n  name,\n  children,\n  ...props\n}: Omit<ComponentProps<'kbd'>, 'children'> & KbdKeyProps) {\n  const { held, label } = useKbdKey({ name, children })\n  return (\n    <kbd\n      data-slot='kbd'\n      data-held={held ? '' : undefined}\n      className={cn(\n        // In em, so a key fits the text it sits in, from a tooltip's line to a heading. Half the\n        // shape's small corner, so Round makes it a pill and Standard keeps a key's soft corner.\n        'relative inline-flex h-[1.75em] min-w-[1.75em] shrink-0 items-center justify-center gap-[0.25em] rounded-[min(calc(var(--control-radius-xs)/2),0.875em)] border border-current/20 px-[0.45em] align-middle font-sans text-[length:max(0.6875rem,0.8em)] leading-none font-medium whitespace-nowrap tabular-nums shadow-[0_1px_0_0_color-mix(in_oklab,currentColor_25%,transparent)] select-none',\n        // Down quicker than back up, as a Button's press is.\n        'transition-[box-shadow,translate] duration-(--motion-press-duration) ease-[var(--motion-press-fade-easing),var(--motion-press-easing)] data-held:translate-y-(--kbd-sink,1px) data-held:shadow-none data-held:duration-[calc(var(--motion-press-duration)*0.4)] motion-reduce:data-held:translate-y-0',\n        'forced-colors:border-[CanvasText] forced-colors:data-held:bg-[Highlight] forced-colors:data-held:text-[HighlightText] forced-colors:data-held:forced-color-adjust-none',\n        '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-[1.1em]',\n        className,\n      )}\n      {...props}\n    >\n      {label}\n    </kbd>\n  )\n}\n\n/**\n * Keys pressed together, as ⇧⌘P, in the order the platform writes them: its\n * `Kbd`s, or a shortcut as ui-sdk writes it, `keys='mod+shift+p'`.\n */\nfunction KbdGroup({\n  keys: shortcut,\n  className,\n  children,\n  ...props\n}: ComponentProps<'kbd'> & {\n  /** A shortcut as ui-sdk writes it, such as `'mod+k'`, drawn as a `Kbd` per key. */\n  keys?: string\n}) {\n  const { keys } = useOrderedKeys(\n    children ??\n      (shortcut\n        ? shortcutKeys(shortcut).map((key) => <Kbd key={key} name={key} />)\n        : null),\n  )\n  return (\n    <kbd\n      data-slot='kbd-group'\n      className={cn('inline-flex items-center align-middle', className)}\n      {...props}\n    >\n      {/* Keys read left to right in any language; `dir` on the kbd would flip its margin. */}\n      <span dir='ltr' className='inline-flex items-center gap-[0.2em]'>\n        {keys}\n      </span>\n    </kbd>\n  )\n}\n\nexport { Kbd, KbdGroup }\n",
      "type": "registry:component",
      "target": "@components/kino/kbd.tsx"
    }
  ],
  "type": "registry:component"
}