This component no longer exists. It was in blode/ui’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-09 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
Use Copy To Clipboard
blode-ui/use-copy-to-clipboardRemovedUtility
A hook that copies text to the clipboard and resets after a timeout.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/mblode/blode-ui/main/public/r/use-copy-to-clipboard.jsonSource
1"use client";23import { useState } from "react";45export const useCopyToClipboard = ({6 timeout = 2000,7 onCopy,8}: {9 timeout?: number;10 onCopy?: () => void;11} = {}) => {12 const [isCopied, setIsCopied] = useState(false);1314 const copyToClipboard = async (value: string) => {15 if (typeof window === "undefined" || !navigator.clipboard.writeText) {16 return;17 }1819 if (!value) {20 return;21 }2223 try {24 await navigator.clipboard.writeText(value);25 setIsCopied(true);2627 if (onCopy) {28 onCopy();29 }3031 if (timeout !== 0) {32 setTimeout(() => {33 setIsCopied(false);34 }, timeout);35 }36 } catch (error) {37 console.error(error);38 }39 };4041 return { copyToClipboard, isCopied };42};
