Component packs › Ditto › Code Copy
Each line of the code block peels off in turn and streams into the clipboard, top to bottom, before the button says copied.
Code Copy is a copy from Ditto, a component pack with 6 copy and share controls: Copy and share where you see the copy happen: the text lifts off and drops into the clipboard. Price: $2 for the whole pack.
Built with: staggered line flights, token colouring, line numbers left out of the copy.
Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.
| Prop | Type | Default | Description |
|---|---|---|---|
code | string | The code. | |
file | string | "install.sh" | File or language shown in the header. Default "install.sh". |
onCopy | (code: string, ok: boolean) => void | ||
dark | boolean | ||
autoplay | number | false | Showcase mode: copies itself every N ms. |
copy(): Promise<boolean>destroy(): voidimport CodeCopy from './CodeCopy';
<CodeCopy />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Copy and share.