1.0.7 โข Published 5 months ago
next-clippy v1.0.7
Next Clippy ๐
Next Clippy is a lightweight React hook that enables seamless text copying functionality in Next.js applications.
โจ Features
๐ Copy text to the clipboard effortlessly.
๐ Provides a
copied
state to track the copying status.โก Optimized for Next.js and modern React development.
๐ฆ Installation
Use npm or yarn to install:
npm install next-clippy
or
yarn add next-clippy
๐ Usage
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>
);
}
๐ API
useClipboard()
Returns an object containing:
๐
copy(text: string)
: Copies the provided text to the clipboard.โ
copied: boolean
: Indicates whether the text was recently copied.
๐งช Running Tests
Ensure jest
and @testing-library/react-hooks
are installed. Then run:
npm test
๐ค Contributing
Contributions are welcome! ๐ Feel free to fork the repository and submit a pull request.
๐ License
This project is licensed under the MIT License. ๐