Code Block
Copy With Timer
A code block with copy where the "Copied" label rolls back on its own: a bar under the button shows how long is left before it returns.
React + Tailwind, shadcn-compatible: press “Copy for AI” and your Cursor or Claude Code agent installs it with the shadcn CLI.
What you can change
- the code of the block and the heading through title
- the button captions through label and doneLabel
- the rollback duration through resetDelay
A link for your AI agent: preview, code and instructions.
Preview

Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this on the home page as the hero:
https://vibeui.club/c/codeblock-002?lang=en&theme=dark
Not sure where to paste it? Step-by-step guide
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
Loading…
How to use
<Codeblock002
title="app/page.tsx"
label="Copy"
resetDelay={2000}
/>A sample call. The agent installs the component itself from the registry via the “Copy for AI” link.
Settings
- Button caption
label· default: Copy- Caption after copying
doneLabel· default: Copied- Rollback, ms
resetDelay· default: 2000- Background
background· default: theme colour
More in Code Block
FAQ
- How do I add Copy With Timer with Cursor or Claude Code?
- Press “Copy for AI” on this page and paste it into your agent's chat. The instruction contains the shadcn CLI install command, the dependencies and what to keep, so the agent installs this exact component instead of recreating a lookalike.
- What does Copy With Timer depend on?
- No npm packages beyond React and Tailwind CSS.
- What can I change in Copy With Timer?
- Adapt: the code of the block and the heading through title; the button captions through label and doneLabel; the rollback duration through resetDelay. Keep as installed: the local --vibeui-codeblock-002-* palette — do not swap it for your theme tokens; the rollback bar: without it "Copied" looks like a stuck state and people click again; one source of duration for the timer and the animation — otherwise the bar lies about the return.
- Is Copy With Timer free?
- Yes. The preview is open without an account; with a free account you can copy up to 20 components a month.
For developers
npx shadcn@latest add https://vibeui.club/r/pro/codeblock-002.jsonThis command needs a signed link: sign in and open “Component source” below — it issues a working link valid for 30 minutes. All install options
Technical notes
The component is self-contained: one file, zero dependencies, its own palette in the local --vibeui-codeblock-002-* variables. Client component: the "use client" directive is needed for navigator.clipboard and the rollback timer. The rollback duration from the resetDelay prop goes at once into setTimeout and into the CSS variable that drives the bar animation duration, so the indicator and the state are always in agreement. The timer is cleared in useEffect on unmount, otherwise a setState would land in a dead component. The theme comes from the surrounding color-scheme through light-dark(): the block has no surface by default, and the border and the button chip rest on translucent overlays and read on any page.
Tags
- code
- copy
- clipboard
- feedback
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…