{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "duck-spinner", "title": "Duck Spinner", "description": "The duck/ui logo paddling on water, with the wake as expanding rings. Ships the mark into your public folder so the loading path is same-origin. Pass src to spin any image URL instead. Also exports DuckGlyph, the mark used by loading states.", "registryDependencies": [ "@duck/theme" ], "files": [ { "path": "registry/duck/ui/duck-spinner.tsx", "content": "import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * The official duck/ui mark. The registry ships the SVG into your `public/`,\n * so it is a same-origin request: the loading path still works offline and\n * under an `img-src 'self'` policy, which is exactly when a spinner matters.\n * (SVG rather than the site's PNG because the CLI inlines registry files as\n * text — a raster asset would arrive corrupt.) Point `src` at your own image\n * to brand the spinner, or edit this constant once to swap it everywhere —\n * DuckSpinner, QuackButton's loading state and QuackToast's quack variant all\n * read it.\n */\nconst DUCK_MARK_SRC = \"/duck.svg\";\n\ntype DuckGlyphProps = Omit, \"alt\"> & {\n /** Any image URL: remote, /public path or data URI. */\n src?: string;\n /** Leave empty for decoration; the spinner already announces itself. */\n alt?: string;\n};\n\n/**\n * DuckGlyph — the mark as an image. Reused by the spinner and by loading\n * states, so one `src` covers every place the duck shows up.\n */\nfunction DuckGlyph({\n className,\n src = DUCK_MARK_SRC,\n alt = \"\",\n ...props\n}: DuckGlyphProps) {\n return (\n \n );\n}\n\nconst spinnerSizes = {\n sm: \"size-5\",\n default: \"size-8\",\n lg: \"size-12\",\n} as const;\n\nconst spinnerMotion = {\n paddle: \"[animation:duck-paddle_0.9s_ease-in-out_infinite]\",\n spin: \"animate-spin\",\n} as const;\n\n/**\n * DuckSpinner — a duck paddling on water. The rings are the wake.\n */\nfunction DuckSpinner({\n className,\n size = \"default\",\n motion = \"paddle\",\n src,\n label = \"Loading\",\n ...props\n}: React.ComponentProps<\"span\"> & {\n size?: keyof typeof spinnerSizes;\n /** paddle rocks the mark, spin rotates it a full turn. */\n motion?: keyof typeof spinnerMotion;\n /** Custom mark image. Defaults to the duck/ui logo in your public folder. */\n src?: string;\n label?: string;\n}) {\n return (\n \n \n \n \n {label}\n \n );\n}\n\nexport { DuckSpinner, DuckGlyph, DUCK_MARK_SRC };\n", "type": "registry:ui" }, { "path": "public/duck.svg", "content": "\n \n \n \n \n \n \n \n\n", "type": "registry:file", "target": "~/public/duck.svg" } ], "type": "registry:ui" }