{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ink/tag",
  "title": "Tag",
  "description": "Removable chip/tag",
  "dependencies": [
    "ink"
  ],
  "registryDependencies": [
    "https://termcn.dev/r/ink/interaction.json",
    "https://termcn.dev/r/ink/terminal-style.json",
    "https://termcn.dev/r/ink/use-theme.json",
    "https://termcn.dev/r/ink/use-unicode.json"
  ],
  "files": [
    {
      "path": "registry/ui/tag.tsx",
      "content": "import { Box, Text } from \"ink\";\nimport type { ReactNode } from \"react\";\n\nimport {\n  isActivationKey,\n  useInteraction,\n} from \"@/hooks/use-interaction\";\nimport type { InteractionProps } from \"@/hooks/use-interaction\";\nimport { useTheme } from \"@/hooks/use-theme\";\nimport { useUnicode } from \"@/hooks/use-unicode\";\nimport { resolveBorderStyle } from \"@/lib/terminal-style\";\n\nexport type TagVariant = \"default\" | \"outline\";\n\nexport interface TagProps extends InteractionProps {\n  children: ReactNode;\n  onRemove?: () => void;\n  color?: string;\n  variant?: TagVariant;\n  \"aria-label\"?: string;\n}\n\nexport const Tag = ({\n  children,\n  onRemove,\n  color,\n  variant = \"default\",\n  id,\n  autoFocus,\n  isActive,\n  disabled,\n  \"aria-label\": ariaLabel,\n}: TagProps) => {\n  const unicode = useUnicode();\n  const theme = useTheme();\n  const resolvedColor = color ?? theme.colors.primary;\n  const borderColor =\n    variant === \"outline\" ? theme.colors.mutedForeground : resolvedColor;\n  const { isFocused } = useInteraction(\n    (input, key) => {\n      if (isActivationKey(input, key) || key.delete || key.backspace) {\n        onRemove?.();\n      }\n    },\n    { autoFocus, disabled, id, isActive: isActive && Boolean(onRemove) }\n  );\n\n  return (\n    <Box\n      borderStyle={resolveBorderStyle(\"round\", unicode)}\n      borderColor={borderColor}\n      paddingX={1}\n      flexDirection=\"row\"\n      aria-role={onRemove ? \"button\" : \"listitem\"}\n      aria-label={\n        ariaLabel ??\n        (typeof children === \"string\"\n          ? `${children}${onRemove ? \", removable\" : \"\"}`\n          : onRemove\n            ? \"Removable tag\"\n            : \"Tag\")\n      }\n      aria-state={{ disabled: disabled || undefined }}\n    >\n      <Text\n        color={\n          variant === \"outline\" ? theme.colors.mutedForeground : resolvedColor\n        }\n      >\n        {children}\n      </Text>\n      {onRemove && (\n        <Text aria-hidden color={theme.colors.mutedForeground}>\n          {isFocused ? (unicode ? \" [×]\" : \" [x]\") : unicode ? \" ×\" : \" x\"}\n        </Text>\n      )}\n    </Box>\n  );\n};\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "typography"
  ],
  "type": "registry:ui"
}