{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "icon-button",
  "title": "IconButton",
  "description": "A button with only an icon. Its label is required and shows as a tooltip.",
  "registryDependencies": [
    "https://creance.pages.dev/r/button.json",
    "https://creance.pages.dev/r/creance-base.json",
    "https://creance.pages.dev/r/tooltip.json"
  ],
  "files": [
    {
      "path": "icon-button/IconButton.css",
      "content": ".cr-icon-button {\n  min-width: var(--cr-control-height-md);\n  padding: 0;\n}\n\n.cr-icon-button[data-size='sm'] {\n  min-width: var(--cr-control-height-sm);\n}\n\n.cr-icon-button__icon {\n  display: inline-flex;\n  font-size: var(--cr-font-size-lg);\n}\n",
      "type": "registry:file",
      "target": "@components/creance/icon-button/IconButton.css"
    },
    {
      "path": "icon-button/IconButton.tsx",
      "content": "import { forwardRef, type ReactNode } from 'react';\nimport { Button, type ButtonProps } from '@/components/creance/button/Button';\nimport { Tooltip } from '@/components/creance/tooltip/Tooltip';\nimport { cx } from '@/lib/creance/cx';\nimport './IconButton.css';\n\nexport interface IconButtonProps extends Omit<ButtonProps, 'children' | 'aria-label'> {\n  /** Accessible name, also shown as a tooltip. Required: an icon alone has no name. */\n  label: string;\n  icon: ReactNode;\n  /** Show `label` in a tooltip on hover and focus. */\n  tooltip?: boolean;\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n  { label, icon, tooltip = true, variant = 'ghost', className, ...props },\n  ref,\n) {\n  const button = (\n    <Button ref={ref} variant={variant} aria-label={label} className={cx('cr-icon-button', className)} {...props}>\n      <span aria-hidden=\"true\" className=\"cr-icon-button__icon\">\n        {icon}\n      </span>\n    </Button>\n  );\n  return tooltip ? <Tooltip content={label}>{button}</Tooltip> : button;\n});\n",
      "type": "registry:ui",
      "target": "@components/creance/icon-button/IconButton.tsx"
    }
  ],
  "categories": [
    "atom",
    "actions"
  ],
  "type": "registry:ui"
}