BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/guarahooks/use-copy-to-clipboard-demo

UseCopyToClipboardDemo

guarahooks/use-copy-to-clipboard-demo
FreeExample

use-copy-to-clipboard's hook in action.

Live preview

live · rendered by the registry
Rendered by guarahooks on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://guarahooks.com/r/use-copy-to-clipboard-demo.json

Source

registry/example/use-copy-to-clipboard-demo.tsxguarahooks.com/r/use-copy-to-clipboard-demo.json
1'use client';
2
3import React, { useState } from 'react';
4
5import { Button } from '@/components/ui/button';
6import {
7 Card,
8 CardContent,
9 CardDescription,
10 CardHeader,
11 CardTitle,
12} from '@/components/ui/card';
13import { Input } from '@/components/ui/input';
14
15import { useCopyToClipboard } from '@/hooks/guarahooks/use-copy-to-clipboard';
16
17export function UseCopyToClipboardDemo() {
18 const [text, setText] = useState('');
19 const { copied, copy } = useCopyToClipboard();
20
21 return (
22 <Card className="relative max-w-sm w-full">
23 <CardHeader>
24 <CardTitle>useCopyToClipboard</CardTitle>
25 <CardDescription>
26 This component uses the <code>useCopyToClipboard</code> hook to copy
27 text to the clipboard.
28 </CardDescription>
29 </CardHeader>
30 <CardContent className="space-y-4">
31 <Input
32 value={text}
33 onChange={(e) => setText(e.target.value)}
34 placeholder="Type something to copy..."
35 />
36 <div className="flex items-center gap-2">
37 <Button onClick={() => copy(text)} disabled={!text}>
38 Copiar
39 </Button>
40 {copied && (
41 <span className="text-green-500 bg-green-500/20 px-2 py-0.5 rounded-md">
42 Copied!
43 </span>
44 )}
45 </div>
46 </CardContent>
47 </Card>
48 );
49}

What it pulls in

Other registry items

  • card
  • button
  • input
  • https://guarahooks.com/r/use-copy-to-clipboard.json

Files it writes

  • registry/example/use-copy-to-clipboard-demo.tsx

Facts

Registry
guarahooks
Type
registry:example
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
today

Go to the source

Docs on guarahooks guarahooks.com h3rmel/guarahooks on GitHub Raw registry item This item as JSON

More from guarahooks

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
UseAbortControllerDemouse-abort-controller-demoguarahooksExamplesFreeno deps
UseArrayStateDemouse-array-state-demoguarahooksExamplesFreeno deps
UseAxiosDemouse-axios-demoguarahooksExamplesFreeno deps
UseBatteryStatusDemouse-battery-status-demoguarahooksExamplesFreeno deps
UseBetterAuthDemouse-better-auth-demoguarahooksExamplesFreeno deps
UseClickOutsideDemouse-click-outside-demoguarahooksExamplesFreeno deps
UseConfirmDemouse-confirm-demoguarahooksExamplesFreeno deps
UseCookieDemouse-cookie-demoguarahooksExamplesFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex