Skip to main content

priv/registry/kbd.json

{
  "files": [
    {
      "content": "defmodule Shadix.Components.Kbd do\n  @moduledoc \"\"\"\n  Kbd component translated from the shadcn-ui \"kbd\" component.\n\n  Exposes `kbd/1` and `kbd_group/1`, both rendering `<kbd>` elements with the\n  corresponding `data-slot` values from the original source.\n  \"\"\"\n  use Phoenix.Component\n  import Shadix.Cn\n\n  attr(:class, :string, default: nil)\n  attr(:rest, :global)\n  slot(:inner_block, required: true)\n\n  def kbd(assigns) do\n    class =\n      cn([\n        \"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none\",\n        \"[&_svg:not([class*='size-'])]:size-3\",\n        \"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10\",\n        assigns.class\n      ])\n\n    assigns = assign(assigns, :computed_class, class)\n\n    ~H\"\"\"\n    <kbd data-slot=\"kbd\" class={@computed_class} {@rest}>{render_slot(@inner_block)}</kbd>\n    \"\"\"\n  end\n\n  attr(:class, :string, default: nil)\n  attr(:rest, :global)\n  slot(:inner_block, required: true)\n\n  def kbd_group(assigns) do\n    class = cn([\"inline-flex items-center gap-1\", assigns.class])\n    assigns = assign(assigns, :computed_class, class)\n\n    ~H\"\"\"\n    <kbd data-slot=\"kbd-group\" class={@computed_class} {@rest}>{render_slot(@inner_block)}</kbd>\n    \"\"\"\n  end\nend\n",
      "path": "kbd.ex"
    }
  ],
  "hooks": [],
  "name": "kbd",
  "npm_deps": [],
  "registry_deps": [
    "cn"
  ]
}