{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "loader-icon", "type": "registry:ui", "title": "Loader Icon", "description": "Loader icon component.", "dependencies": [ "motion" ], "files": [ { "path": "registry/icons/loader/index.tsx", "content": "'use client';\n\nimport * as React from 'react';\nimport { motion, type Variants } from 'motion/react';\n\nimport {\n getVariants,\n useAnimateIconContext,\n IconWrapper,\n type IconProps,\n} from '@/components/animate-ui/icons/icon';\n\ntype LoaderProps = IconProps;\n\nconst SEGMENT_COUNT = 8;\nconst DURATION = 1.2;\nconst BASE_OPACITY = 0.25;\n\nconst animations = {\n default: (() => {\n const spinner: Record = {\n group: { initial: {}, animate: {} },\n };\n\n for (let i = 1; i <= SEGMENT_COUNT; i++) {\n const reverseIndex = SEGMENT_COUNT - i;\n const delay = -(reverseIndex * DURATION) / SEGMENT_COUNT;\n\n spinner[`path${i}`] = {\n initial: { opacity: 1 },\n animate: {\n opacity: [1, BASE_OPACITY],\n transition: {\n duration: DURATION,\n ease: 'linear',\n repeat: Infinity,\n repeatType: 'loop',\n delay,\n },\n },\n };\n }\n\n return spinner as Record;\n })() satisfies Record,\n spin: {\n group: {\n initial: { rotate: 0 },\n animate: {\n rotate: 360,\n transition: {\n duration: 1.5,\n ease: 'linear',\n repeat: Infinity,\n repeatType: 'loop',\n },\n },\n },\n path1: {},\n path2: {},\n path3: {},\n path4: {},\n path5: {},\n path6: {},\n path7: {},\n path8: {},\n } satisfies Record,\n} as const;\n\nfunction IconComponent({ size, ...props }: LoaderProps) {\n const { controls } = useAnimateIconContext();\n const variants = getVariants(animations);\n\n return (\n \n \n \n \n \n \n \n \n \n \n );\n}\n\nfunction Loader(props: LoaderProps) {\n return ;\n}\n\nexport {\n animations,\n Loader,\n Loader as LoaderIcon,\n type LoaderProps,\n type LoaderProps as LoaderIconProps,\n};\n", "type": "registry:ui", "target": "components/animate-ui/icons/loader.tsx" } ], "meta": { "keywords": [ "loading", "wait", "busy", "progress", "throbber", "spinner", "spinning" ] } }