own-component
v2.0.0
Published
A simple React Copy to Clipboard button component.
Maintainers
Readme
React Clipboard Components
Tiny React components for copying text to the clipboard with simple UI states.
Install
- npm:
npm install own-component - yarn:
yarn add own-component
Usage
import { CopyToClipboardButton, CopyToClipboardIconButton, CopyToClipboardInput } from 'own-component';
export default function Example() {
return (
<div>
{/* Basic button */}
<CopyToClipboardButton textToCopy="Hello world" />
{/* Icon-only button with accessible labels */}
<CopyToClipboardIconButton
textToCopy="Hello world"
ariaLabel="Copy to clipboard"
copiedAriaLabel="Copied!"
/>
{/* Input + copy button */}
<CopyToClipboardInput
initialValue="Start typing..."
placeholder="Enter text to copy"
/>
</div>
);
}