1.0.2 • Published 11 months ago

react-admin-copy-to-clipboard v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

react-admin-copy-to-clipboard

react-admin-copy-to-clipboard is a simple React component that allows users to copy text to the clipboard with a single click. It is designed to work seamlessly with React-Admin and can be easily integrated into your React applications.

Installation

You can install the library via npm or yarn:

npm install react-admin-copy-to-clipboard

or 

yarn add react-admin-copy-to-clipboard

Usage:

To use the "CopyButton" component in your React application, import it and provide the text you want to copy as a prop. You can also customize the button content by placing children elements inside the "CopyButton" component.

Here’s a basic example of how to use "CopyButton":

import React from 'react';
import { CopyButton } from 'react-admin-copy-to-clipboard';

const MyComponent = () => {
  return (
    <div>
      <p>Some text to copy</p>
      <CopyButton text="Some text to copy">Copy to Clipboard</CopyButton>
    </div>
  );
};

export default MyComponent;

Props

  • text (string): The text that will be copied to the clipboard when the button is clicked.
  • children (React.ReactNode): The content to display inside the button. This can be any valid React node (e.g., text, JSX elements).

API

CopyButton
  • text (string): Required. The text to copy to the clipboard.
  • children (React.ReactNode): Optional. The content inside the button.
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago