Next Clippy is a lightweight React hook that enables seamless text copying functionality in Next.js applications.
-
📋 Copy text to the clipboard effortlessly.
-
🔄 Provides a
copied
state to track the copying status. -
⚡ Optimized for Next.js and modern React development.
Use npm or yarn to install:
npm install next-clippy
or
yarn add next-clippy
Import and use the useClipboard
hook in your component:
import { useClipboard } from "next-clippy";
export default function CopyComponent() {
const { copy, copied } = useClipboard();
return (
<div>
<button onClick={() => copy("Hello, World!")}>Copy Text</button>
{copied && <span>Copied! ✅</span>}
</div>
);
}
Returns an object containing:
-
📌
copy(text: string)
: Copies the provided text to the clipboard. -
✅
copied: boolean
: Indicates whether the text was recently copied.
Ensure jest
and @testing-library/react-hooks
are installed. Then run:
npm test
Contributions are welcome! 🎉 Feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License. 📝