next-clippy
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Next Clippy 📋

Next Clippy Logo

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. 📝

Package Sidebar

Install

npm i next-clippy

Weekly Downloads

23

Version

1.0.7

License

MIT

Unpacked Size

505 kB

Total Files

11

Last publish

Collaborators

  • david-chika