{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ink-check",
  "type": "registry:item",
  "title": "Ink Check",
  "description": "A checkbox whose tick is inked in one stroke while the box fills, with an optional strike-through label.",
  "categories": [
    "input"
  ],
  "dependencies": [
    "react-native-reanimated",
    "react-native-worklets"
  ],
  "registryDependencies": [
    "https://kinetik-ui.dev/r/kinetik-tokens.json",
    "https://kinetik-ui.dev/r/kinetik-motion.json",
    "https://kinetik-ui.dev/r/kinetik-haptics.json"
  ],
  "files": [
    {
      "path": "src/components/kinetik/ink-check.tsx",
      "type": "registry:file",
      "target": "~/components/kinetik/ink-check.tsx",
      "content": "import { useEffect, useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';\nimport Animated, {\n  interpolateColor,\n  useAnimatedStyle,\n  useSharedValue,\n  withSpring,\n  withTiming,\n} from 'react-native-reanimated';\n\nimport { useHaptic } from '../../lib/kinetik/hooks/use-haptic';\nimport { useReduceMotion } from '../../lib/kinetik/hooks/use-reduce-motion';\nimport { durations, easings, spring } from '../../lib/kinetik/motion/motion';\nimport { useKinetikTheme } from '../../lib/kinetik/tokens/theme';\nimport { minTouchTarget } from '../../lib/kinetik/tokens/tokens';\n\nexport type InkCheckProps = {\n  /** The line beside the box. It names the checkbox for screen readers. */\n  label: string;\n  /** A quieter line under the label. */\n  description?: string;\n  checked: boolean;\n  onCheckedChange: (checked: boolean) => void;\n  /** Strike the label through when checked, as in a to-do list. Defaults to false. */\n  strike?: boolean;\n  /** Box fill when checked. Defaults to the theme azure. */\n  color?: string;\n  /** A tick as it checks. Defaults to true. */\n  haptics?: boolean;\n  disabled?: boolean;\n  testID?: string;\n  style?: StyleProp<ViewStyle>;\n};\n\nconst BOX = 22;\nconst BORDER = 1.5;\nconst STROKE = 2.5;\n/** The tick as two strokes in the box's 22 pt space: down to the elbow, then up. */\nconst ELBOW = { x: 9.25, y: 15 };\nconst SHORT = { x: 5.5, y: 11.25, length: Math.hypot(ELBOW.x - 5.5, ELBOW.y - 11.25) };\nconst LONG = { x: 16.75, y: 6.75 };\nconst LONG_LENGTH = Math.hypot(LONG.x - ELBOW.x, LONG.y - ELBOW.y);\nconst SHORT_ANGLE = Math.atan2(ELBOW.y - SHORT.y, ELBOW.x - SHORT.x);\nconst LONG_ANGLE = Math.atan2(LONG.y - ELBOW.y, LONG.x - ELBOW.x);\n/** Share of the stroke spent on the short leg, so the pen moves at one speed. */\nconst SPLIT = SHORT.length / (SHORT.length + LONG_LENGTH);\n\n/**\n * A checkbox whose tick is inked in one stroke: down to the elbow, then up,\n * at the speed of a pen. The box fills behind it with a small press, and the\n * label can be struck through like a finished to-do.\n */\nexport function InkCheck({\n  label,\n  description,\n  checked,\n  onCheckedChange,\n  strike = false,\n  color,\n  haptics = true,\n  disabled = false,\n  testID,\n  style,\n}: InkCheckProps) {\n  const { colors, font, space, radius } = useKinetikTheme();\n  const reduced = useReduceMotion();\n  const haptic = useHaptic(haptics);\n  const ink = color ?? colors.azure;\n  const [labelWidth, setLabelWidth] = useState(0);\n\n  const fill = useSharedValue(checked ? 1 : 0);\n  const stroke = useSharedValue(checked ? 1 : 0);\n  const press = useSharedValue(0);\n\n  useEffect(() => {\n    fill.set(withSpring(checked ? 1 : 0, spring('snappy', reduced)));\n    // The tick draws after the box has started to fill, and erases quickly.\n    stroke.set(\n      reduced\n        ? checked\n          ? 1\n          : 0\n        : withTiming(checked ? 1 : 0, {\n            duration: checked ? durations.slow : durations.quick,\n            easing: easings.standard,\n          }),\n    );\n  }, [checked, reduced, fill, stroke]);\n\n  const toggle = () => {\n    if (!checked) haptic('tick');\n    onCheckedChange(!checked);\n  };\n\n  const box = useAnimatedStyle(() => ({\n    backgroundColor: interpolateColor(fill.get(), [0, 1], [colors.surface, ink]),\n    borderColor: interpolateColor(fill.get(), [0, 1], [colors.borderStrong, ink]),\n    transform: [{ scale: 1 - press.get() * 0.12 + Math.sin(fill.get() * Math.PI) * 0.06 }],\n  }));\n  const shortLeg = useAnimatedStyle(() => ({\n    width: SHORT.length * Math.min(1, stroke.get() / SPLIT),\n  }));\n  const longLeg = useAnimatedStyle(() => ({\n    width: LONG_LENGTH * Math.max(0, (stroke.get() - SPLIT) / (1 - SPLIT)),\n  }));\n  const strikeLine = useAnimatedStyle(() => ({ width: labelWidth * stroke.get() }));\n  const labelInk = useAnimatedStyle(() => ({\n    color: strike\n      ? interpolateColor(stroke.get(), [0, 1], [colors.text, colors.textMuted])\n      : colors.text,\n  }));\n\n  return (\n    <Pressable\n      testID={testID}\n      disabled={disabled}\n      onPress={toggle}\n      onPressIn={() => press.set(withSpring(1, spring('snappy', reduced)))}\n      onPressOut={() => press.set(withSpring(0, spring('bouncy', reduced)))}\n      accessibilityRole=\"checkbox\"\n      accessibilityLabel={label}\n      accessibilityHint={description}\n      accessibilityState={{ checked, disabled }}\n      style={[styles.row, { gap: space[3], opacity: disabled ? 0.45 : 1 }, style]}\n    >\n      <Animated.View style={[styles.box, { borderRadius: radius.xs }, box]}>\n        <Animated.View\n          style={[\n            styles.leg,\n            {\n              left: SHORT.x - BORDER,\n              top: SHORT.y - STROKE / 2 - BORDER,\n              backgroundColor: colors.onAzure,\n            },\n            { transform: [{ rotate: `${SHORT_ANGLE}rad` }] },\n            shortLeg,\n          ]}\n        />\n        <Animated.View\n          style={[\n            styles.leg,\n            {\n              left: ELBOW.x - BORDER,\n              top: ELBOW.y - STROKE / 2 - BORDER,\n              backgroundColor: colors.onAzure,\n            },\n            { transform: [{ rotate: `${LONG_ANGLE}rad` }] },\n            longLeg,\n          ]}\n        />\n      </Animated.View>\n      <View style={styles.text}>\n        <View style={styles.labelRow}>\n          <Animated.Text\n            numberOfLines={1}\n            onLayout={(e) => setLabelWidth(e.nativeEvent.layout.width)}\n            style={[{ fontSize: font.size.md, fontWeight: font.weight.medium }, labelInk]}\n          >\n            {label}\n          </Animated.Text>\n          {strike ? (\n            <Animated.View\n              pointerEvents=\"none\"\n              style={[styles.strike, { backgroundColor: colors.textMuted }, strikeLine]}\n            />\n          ) : null}\n        </View>\n        {description ? (\n          <Text numberOfLines={2} style={{ color: colors.textMuted, fontSize: font.size.sm }}>\n            {description}\n          </Text>\n        ) : null}\n      </View>\n    </Pressable>\n  );\n}\n\nconst styles = StyleSheet.create({\n  row: {\n    flexDirection: 'row',\n    alignItems: 'center',\n    minHeight: minTouchTarget,\n    paddingVertical: 6,\n  },\n  box: { width: BOX, height: BOX, borderWidth: BORDER },\n  // Each leg grows from its start point; the origin keeps that point fixed while it turns.\n  leg: {\n    position: 'absolute',\n    height: STROKE,\n    borderRadius: STROKE / 2,\n    transformOrigin: 'left center',\n  },\n  text: { flex: 1, gap: 2 },\n  labelRow: { alignSelf: 'flex-start', maxWidth: '100%' },\n  strike: {\n    position: 'absolute',\n    left: 0,\n    top: '50%',\n    marginTop: 0.5,\n    height: 1.5,\n    borderRadius: 1,\n  },\n});\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "kind": "component",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "category": "input",
    "web": "live",
    "perf": {
      "budget": "Plain views: the tick is two rotated bars whose widths grow. No canvas, so a long list of them stays cheap. Nothing runs at rest.",
      "measurements": [
        {
          "device": "Pixel 9 emulator, API 35",
          "kind": "emulator",
          "date": "2026-10-13",
          "build": "release",
          "frameMs": 23,
          "p90Ms": 27,
          "baselineMs": 20,
          "jankyPercent": 1.66,
          "atRest": "idle",
          "memoryMb": 147
        }
      ]
    },
    "a11y": {
      "reducedMotion": "The box fills and the tick appears at once; the strike-through appears without sweeping.",
      "screenReader": "A checkbox named by its label, with the description as its hint and a checked state.",
      "touchTarget": "The whole row is the target, at least 44 pt tall."
    },
    "requires": "React Native New Architecture (Reanimated 4)",
    "guide": "## Usage\n\n```tsx\nimport { InkCheck } from '@/components/kinetik/ink-check';\n\n<InkCheck\n  label=\"Book the flights\"\n  description=\"Lisbon, 14 to 21 June\"\n  checked={booked}\n  onCheckedChange={setBooked}\n/>;\n```\n\nSet `strike` for to-do lists: the label is struck through and greys a little once it is checked.\n\n## When to use\n\n- Lists of independent choices: settings, filters, a to-do or packing list.\n- Consent and agreement lines in forms.\n\n## When not to use\n\n- A setting that takes effect immediately. Use a switch, such as Pulse Toggle.\n- Choosing one option from a set. Use Choice Cards or radio buttons.\n\n## Notes\n\n- The tick is drawn by two plain views rather than a canvas, so a screen with fifty checkboxes costs no more than fifty small views.\n- The tick is drawn in `onAzure`. If you pass a light `color`, check the contrast of the tick against it.\n- The label stays on one line so the strike-through can follow it; put detail in `description`.\n- With reduced motion the box and tick change at once.\n"
  },
  "docs": "Prefer `npx kinetik-ui add ink-check`: it installs dependencies with expo install, so versions match your Expo SDK."
}
