{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion-kit",
  "title": "MotionKit Provider",
  "description": "Sets the temperament (calm, lively, playful), global time scale and reduced-motion policy for every MotionKit component.",
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://reactmotionkit.com/r/motion-presets.json",
    "https://reactmotionkit.com/r/use-prefers-reduced-motion.json"
  ],
  "files": [
    {
      "path": "lib/motion-kit.tsx",
      "content": "\"use client\"\n\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\"\n\nimport { usePrefersReducedMotion } from \"@/hooks/use-prefers-reduced-motion\"\nimport { createMotion, DEFAULT_TEMPERAMENT, type Temperament } from \"@/lib/motion\"\n\ninterface MotionKitSettings {\n  temperament: Temperament\n  timeScale: number\n  reducedMotion: \"user\" | \"always\" | \"never\"\n  portalContainer: HTMLElement | null\n}\n\nconst MotionKitContext = createContext<MotionKitSettings>({\n  temperament: DEFAULT_TEMPERAMENT,\n  timeScale: 1,\n  reducedMotion: \"user\",\n  portalContainer: null,\n})\n\nexport interface MotionKitProviderProps {\n  /** Character of every MotionKit component inside. A component's own `temperament` prop wins. */\n  temperament?: Temperament\n  /** Global speed: 1 is normal, 0.25 is four times slower. */\n  timeScale?: number\n  /**\n   * `user` follows the OS setting, `always` forces the reduced version\n   * (useful for previews and settings pages), `never` ignores it.\n   */\n  reducedMotion?: \"user\" | \"always\" | \"never\"\n  /**\n   * Where MotionKit dialogs, popovers and other overlays render (default:\n   * `document.body`). Point it at an element inside a themed section so overlays\n   * opened there inherit its theme. Fixed overlays still cover the viewport as\n   * long as no ancestor of the container sets a transform, filter or `contain`.\n   */\n  portalContainer?: HTMLElement | null\n  children: ReactNode\n}\n\n/**\n * Sets the temperament, time scale and reduced-motion policy for every\n * MotionKit component below it. Optional: without it components are `lively`\n * at normal speed and follow the OS reduced-motion setting.\n */\nexport function MotionKitProvider({\n  temperament = DEFAULT_TEMPERAMENT,\n  timeScale = 1,\n  reducedMotion = \"user\",\n  portalContainer = null,\n  children,\n}: MotionKitProviderProps) {\n  const value = useMemo(\n    () => ({ temperament, timeScale, reducedMotion, portalContainer }),\n    [temperament, timeScale, reducedMotion, portalContainer],\n  )\n  return <MotionKitContext value={value}>{children}</MotionKitContext>\n}\n\n/** Raw provider settings, for code that needs the policy rather than resolved tokens. */\nexport function useMotionKitSettings() {\n  return useContext(MotionKitContext)\n}\n\n/** Whether to render the reduced-motion version, combining the OS setting and the provider. */\nexport function useReducedMotionPolicy() {\n  const { reducedMotion } = useContext(MotionKitContext)\n  const prefers = usePrefersReducedMotion()\n  if (reducedMotion === \"always\") return true\n  if (reducedMotion === \"never\") return false\n  return prefers\n}\n\n/**\n * Resolved motion tokens for a component: springs, tweens and amounts for its\n * temperament (the prop wins over the provider), scaled by the global time\n * scale, and replaced by a short fade for reduced motion.\n */\nexport function useMotionKit(temperament?: Temperament) {\n  const settings = useContext(MotionKitContext)\n  const reduced = useReducedMotionPolicy()\n  const resolved = temperament ?? settings.temperament\n  return useMemo(\n    () => createMotion(resolved, settings.timeScale, reduced),\n    [resolved, settings.timeScale, reduced],\n  )\n}\n",
      "type": "registry:lib"
    }
  ],
  "meta": {
    "tier": "free",
    "collection": "interface",
    "needsImage": false,
    "addedAt": "2026-10-13",
    "tags": [
      "motion",
      "temperament",
      "provider"
    ],
    "tech": [],
    "presets": [],
    "keyboard": [],
    "heavy": false
  },
  "categories": [
    "internal"
  ],
  "type": "registry:lib"
}