{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button",
  "title": "Button",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/button/Button.tsx",
      "content": "import * as React from 'react'\nimport { ActivityIndicator, Pressable, Text, type GestureResponderEvent, type PressableProps } from 'react-native'\nimport Animated, {\n  useAnimatedStyle,\n  useReducedMotion,\n  useSharedValue,\n  withSpring,\n  withTiming,\n} from 'react-native-reanimated'\nimport { cn } from '@/lib/utils'\nimport { useThemeColors } from '@/lib/theme'\nimport { enterFor, exitFor, motionDurations, motionSprings, type EnterPreset, type ExitPreset } from '@/lib/motion'\nimport { buttonTextVariants, buttonVariants, type ButtonVariants } from './button.variants'\n\nexport type ButtonPress = 'none' | 'scale' | 'spring'\n\nexport interface ButtonProps extends Omit<PressableProps, 'children'>, ButtonVariants {\n  children?: React.ReactNode\n  className?: string\n  textClassName?: string\n  /** Show the platform activity indicator, disable presses, and mark the control busy. */\n  loading?: boolean\n  /** Override the activity indicator color when the variant default does not fit a custom palette. */\n  loadingColor?: React.ComponentProps<typeof ActivityIndicator>['color']\n  /** Press physics. `scale` dips to 0.97 in 120ms; `spring` uses the shared snappy spring. */\n  press?: ButtonPress\n  /** Mount entrance. Defaults to none — a list of buttons animating on mount reads as noise. */\n  enter?: EnterPreset\n  /** Unmount exit, for buttons removed from a conditional tree. */\n  exit?: ExitPreset\n}\n\nconst Button = React.forwardRef<React.ComponentRef<typeof Pressable>, ButtonProps>(\n  (\n    {\n      className,\n      textClassName,\n      variant = 'default',\n      size = 'default',\n      disabled,\n      loading = false,\n      loadingColor,\n      press = 'scale',\n      enter = 'none',\n      exit = 'none',\n      onPressIn,\n      onPressOut,\n      accessibilityState,\n      children,\n      ...props\n    },\n    ref,\n  ) => {\n    const colors = useThemeColors()\n    const reduced = useReducedMotion()\n    const scale = useSharedValue(1)\n    const isDisabled = !!disabled || loading\n    const animated = press !== 'none' && !reduced && !isDisabled\n    const pressStyle = useAnimatedStyle(() => ({ transform: [{ scale: animated ? scale.value : 1 }] }))\n    const resolvedVariant = variant ?? 'default'\n    const resolvedSize = size ?? 'default'\n    const indicatorColor =\n      loadingColor ??\n      (resolvedVariant === 'default'\n        ? colors.primaryForeground\n        : resolvedVariant === 'destructive'\n          ? colors.destructiveForeground\n          : resolvedVariant === 'secondary'\n            ? colors.secondaryForeground\n            : resolvedVariant === 'link'\n              ? colors.primary\n              : colors.foreground)\n\n    React.useEffect(() => {\n      if (!animated) scale.value = 1\n    }, [animated, scale])\n\n    function handlePressIn(e: GestureResponderEvent) {\n      if (!isDisabled && animated) {\n        scale.value =\n          press === 'spring'\n            ? withSpring(0.96, motionSprings.snappy)\n            : withTiming(0.97, { duration: motionDurations.fast })\n      }\n      onPressIn?.(e)\n    }\n\n    function handlePressOut(e: GestureResponderEvent) {\n      if (!isDisabled && animated) {\n        scale.value =\n          press === 'spring' ? withSpring(1, motionSprings.snappy) : withTiming(1, { duration: motionDurations.fast })\n      }\n      onPressOut?.(e)\n    }\n\n    // Entering and press-transform live on separate views: Reanimated warns\n    // when a layout animation and an animated transform share one view.\n    return (\n      <Animated.View entering={reduced ? undefined : enterFor(enter)} exiting={reduced ? undefined : exitFor(exit)}>\n        <Animated.View style={pressStyle}>\n          <Pressable\n            ref={ref}\n            accessibilityRole=\"button\"\n            accessibilityState={{ ...accessibilityState, disabled: isDisabled, busy: loading }}\n            disabled={isDisabled}\n            onPressIn={handlePressIn}\n            onPressOut={handlePressOut}\n            className={cn(buttonVariants({ variant, size }), disabled && 'opacity-50', className)}\n            {...props}\n          >\n            {loading ? <ActivityIndicator color={indicatorColor} size=\"small\" /> : null}\n            {loading && resolvedSize === 'icon'\n              ? null\n              : // React Native requires text nodes to be inside a Text host.\n                React.Children.map(children, (child) =>\n                  typeof child === 'string' || typeof child === 'number' ? (\n                    <Text className={cn(buttonTextVariants({ variant, size }), textClassName)}>{child}</Text>\n                  ) : (\n                    child\n                  ),\n                )}\n          </Pressable>\n        </Animated.View>\n      </Animated.View>\n    )\n  },\n)\nButton.displayName = 'Button'\n\nexport { Button }\n",
      "type": "registry:ui",
      "target": "~/components/ui/button/Button.tsx"
    },
    {
      "path": "packages/registry-native/components/button/button.variants.ts",
      "content": "import type { VariantProps } from 'class-variance-authority'\nimport { cva } from 'class-variance-authority'\nimport { Platform } from 'react-native'\n\nexport const buttonVariants = cva('min-h-[48px] min-w-[48px] flex-row items-center justify-center gap-2 rounded-md', {\n  variants: {\n    variant: {\n      default: 'bg-primary active:opacity-90',\n      destructive: 'bg-destructive active:opacity-90',\n      outline: 'border border-border bg-background active:bg-accent',\n      secondary: 'bg-secondary active:opacity-80',\n      ghost: 'active:bg-accent',\n      link: '',\n    },\n    size: {\n      default: 'px-4 py-2',\n      sm: 'px-3 py-1.5',\n      lg: 'min-h-[52px] px-6 py-2.5',\n      icon: 'size-[48px]',\n    },\n  },\n  defaultVariants: {\n    variant: 'default',\n    size: 'default',\n  },\n})\n\nexport const buttonTextVariants = cva('shrink text-center font-medium', {\n  variants: {\n    variant: {\n      default: 'text-primary-foreground',\n      destructive: 'text-destructive-foreground',\n      outline: 'text-foreground',\n      secondary: 'text-secondary-foreground',\n      ghost: 'text-foreground',\n      link: 'text-primary underline',\n    },\n    size: {\n      default: Platform.OS === 'ios' ? 'text-[17px] leading-[22px]' : 'text-[16px] leading-[24px]',\n      sm: 'text-[15px] leading-[21px]',\n      lg: 'text-[18px] leading-[24px]',\n      icon: 'text-[15px] leading-[21px]',\n    },\n  },\n  defaultVariants: {\n    variant: 'default',\n    size: 'default',\n  },\n})\n\nexport type ButtonVariants = VariantProps<typeof buttonVariants>\n",
      "type": "registry:ui",
      "target": "~/components/ui/button/button.variants.ts"
    },
    {
      "path": "packages/registry-native/components/button/index.ts",
      "content": "export { Button, type ButtonProps } from './Button'\nexport { buttonTextVariants, buttonVariants, type ButtonVariants } from './button.variants'\n",
      "type": "registry:ui",
      "target": "~/components/ui/button/index.ts"
    }
  ],
  "dependencies": [
    "class-variance-authority",
    "react-native-reanimated"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/motion.json"
  ],
  "description": "Mobile button (Pressable + Text) with 6 variants, 4 sizes, busy loading state, spring/scale press physics, and opt-in entering/exiting motion. NativeWind styled, Expo + bare RN.",
  "categories": [
    "control"
  ]
}