{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "code-window", "title": "Code Window", "description": "Code block in a window frame with a filename, an optional copy control and optional line numbers. Takes plain text or pre-highlighted markup.", "registryDependencies": [ "@duck/theme", "@duck/copy-button" ], "files": [ { "path": "registry/duck/ui/code-window.tsx", "content": "import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { CopyButton } from \"@/components/ui/copy-button\";\n\n/**\n * CodeWindow — a code block in a window frame. Built for tutorial content:\n * a filename, an optional copy control and optional line numbers.\n *\n * Pass plain text as children, or pre-highlighted markup through `html`\n * (for example from Shiki) when the page renders on the server.\n */\nfunction CodeWindow({\n className,\n title,\n children,\n html,\n holo = false,\n copyValue,\n lineNumbers = false,\n ...props\n}: Omit, \"children\"> & {\n title?: string;\n children?: React.ReactNode;\n html?: string;\n holo?: boolean;\n /** Show a copy control that writes this string to the clipboard. */\n copyValue?: string;\n lineNumbers?: boolean;\n}) {\n return (\n \n
\n \n \n \n {title && (\n \n {title}\n \n )}\n {copyValue && (\n \n )}\n
\n \n {html ? (\n \n ) : (\n
{children}
\n )}\n \n \n );\n}\n\nexport { CodeWindow };\n", "type": "registry:ui" } ], "type": "registry:ui" }