{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button",
  "title": "Button",
  "description": "An accessible button with primary, secondary, outline, and ghost variants, a spinning loading state, optional icon, and a focus ring, every color, size, and timing exposed as a prop.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/button/button.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\n\nexport interface ButtonProps {\n  label?: string;\n  onClick?: () => void;\n  type?: \"button\" | \"submit\" | \"reset\";\n  variant?: ButtonVariant;\n  disabled?: boolean;\n  loading?: boolean;\n  fullWidth?: boolean;\n  icon?: React.ReactNode;\n  iconPosition?: \"left\" | \"right\";\n  fontFamily?: string;\n  height?: number;\n  paddingX?: number;\n  fontSize?: number;\n  radius?: number;\n  gap?: number;\n  accentColor?: string;\n  accentTextColor?: string;\n  secondaryColor?: string;\n  secondaryTextColor?: string;\n  borderWidth?: number;\n  ringColor?: string;\n  ringWidth?: number;\n  duration?: number;\n  className?: string;\n}\n\nfunction Spinner({ size, color }: { size: number; color: string }) {\n  return (\n    <motion.svg\n      width={size}\n      height={size}\n      viewBox=\"0 0 16 16\"\n      fill=\"none\"\n      className=\"shrink-0\"\n      animate={{ rotate: 360 }}\n      transition={{ duration: 0.7, repeat: Infinity, ease: \"linear\" }}\n    >\n      <circle cx=\"8\" cy=\"8\" r=\"6.5\" stroke={color} strokeOpacity=\"0.25\" strokeWidth=\"2\" />\n      <path d=\"M14.5 8a6.5 6.5 0 0 0-6.5-6.5\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" />\n    </motion.svg>\n  );\n}\n\nexport function Button({\n  label = \"Button\",\n  onClick,\n  type = \"button\",\n  variant = \"primary\",\n  disabled = false,\n  loading = false,\n  fullWidth = false,\n  icon,\n  iconPosition = \"left\",\n  fontFamily = \"Inter, system-ui, sans-serif\",\n  height = 40,\n  paddingX,\n  fontSize,\n  radius,\n  gap,\n  accentColor = \"#f59e0b\",\n  accentTextColor = \"#ffffff\",\n  secondaryColor = \"#f3f4f6\",\n  secondaryTextColor = \"#111827\",\n  borderWidth = 1.5,\n  ringColor = \"rgba(245,158,11,0.25)\",\n  ringWidth = 3,\n  duration = 0.18,\n  className,\n}: ButtonProps) {\n  const [focused, setFocused] = React.useState(false);\n  const isInactive = disabled || loading;\n\n  const resolvedPaddingX = paddingX ?? height * 0.55;\n  const resolvedFontSize = fontSize ?? height * 0.35;\n  const resolvedRadius = radius ?? height * 0.28;\n  const resolvedGap = gap ?? height * 0.2;\n  const spinnerSize = resolvedFontSize * 1.05;\n\n  const variantStyle: React.CSSProperties =\n    variant === \"primary\"\n      ? { backgroundColor: accentColor, color: accentTextColor, border: \"none\" }\n      : variant === \"secondary\"\n        ? { backgroundColor: secondaryColor, color: secondaryTextColor, border: \"none\" }\n        : variant === \"outline\"\n          ? { backgroundColor: \"transparent\", color: accentColor, border: `${borderWidth}px solid ${accentColor}` }\n          : { backgroundColor: \"transparent\", color: accentColor, border: \"none\" };\n\n  const iconColor = variant === \"primary\" ? accentTextColor : variant === \"secondary\" ? secondaryTextColor : accentColor;\n\n  const content = (\n    <>\n      {loading ? (\n        <Spinner size={spinnerSize} color={iconColor} />\n      ) : (\n        icon && iconPosition === \"left\" && (\n          <span className=\"flex shrink-0 items-center\" style={{ color: iconColor }}>\n            {icon}\n          </span>\n        )\n      )}\n      <span className=\"leading-none whitespace-nowrap\">{label}</span>\n      {!loading && icon && iconPosition === \"right\" && (\n        <span className=\"flex shrink-0 items-center\" style={{ color: iconColor }}>\n          {icon}\n        </span>\n      )}\n    </>\n  );\n\n  return (\n    <motion.button\n      type={type}\n      onClick={isInactive ? undefined : onClick}\n      disabled={isInactive}\n      aria-busy={loading || undefined}\n      onFocus={() => setFocused(true)}\n      onBlur={() => setFocused(false)}\n      className={cn(\"box-border inline-flex items-center justify-center font-semibold select-none\", fullWidth ? \"w-full\" : \"w-fit\", isInactive ? \"cursor-not-allowed\" : \"cursor-pointer\", className)}\n      style={{\n        height,\n        paddingLeft: resolvedPaddingX,\n        paddingRight: resolvedPaddingX,\n        gap: resolvedGap,\n        borderRadius: resolvedRadius,\n        fontFamily,\n        fontSize: resolvedFontSize,\n        opacity: disabled ? 0.5 : loading ? 0.85 : 1,\n        ...variantStyle,\n      }}\n      initial={false}\n      animate={{ boxShadow: focused ? `0 0 0 ${ringWidth}px ${ringColor}` : \"0 0 0 0px rgba(0,0,0,0)\" }}\n      whileHover={isInactive ? undefined : { scale: 1.02 }}\n      whileTap={isInactive ? undefined : { scale: 0.96 }}\n      transition={{ duration }}\n    >\n      {content}\n    </motion.button>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}