copy
Copies the provided text to the user's clipboard.
The useClipboard hook provides a simple way to copy text to the clipboard and track whether the operation completed successfully. It is ideal for copy buttons, invite links, code snippets, and shareable content.
import { useClipboard } from "@shivms/ui";The hook provides methods and state for copying text to the clipboard.
Copies the provided text to the user's clipboard.
Returns whether the copy operation was successful.
Automatically resets the copied state after a delay.
Call the copy() function with the text you want to place on the clipboard.
import {
Button,
useClipboard,
} from "@shivms/ui";
export default function App() {
const {
copy,
copied,
} = useClipboard();
return (
<Button
onClick={() => copy("Hello World")}
>
{copied
? "Copied!"
: "Copy"}
</Button>
);
}Copy any string to the clipboard with a single function call.
Track whether the copy operation completed successfully.
Perfect for copy buttons, invite links, code snippets, and share actions.
Explore more SHIVMS UI documentation and guides.
Learn what SHIVMS UI is and how to begin.
Install the library into your project.
Reusable React hooks for state, themes and responsiveness.
Use built-in icons throughout your application.
Configure light and dark themes.
Reusable helper functions for everyday development.
Build accessible user interfaces.
Customize colors, spacing and components.
See what's new in each release.