
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
@coveops/copy-to-clipboard
Advanced tools
Disclaimer: This component was built by the community at large and is not an official Coveo JSUI Component. Use this component at your own risk.
The CopyToClipboard component allows the user to copy a value specified to their clipboard.
npm i @coveops/copy-to-clipboard
Typescript:
import { CopyToClipboard, ICopyToClipboardOptions } from '@coveops/copy-to-clipboard';
Javascript
const CopyToClipboard = require('@coveops/copy-to-clipboard').CopyToClipboard;
export * from '@coveops/copy-to-clipboard'
<script src="https://unpkg.com/@coveops/copy-to-clipboard@latest/dist/index.min.js"></script>
Disclaimer: Unpkg should be used for testing but not for production.
<div class="CoveoCopyToClipboard"></div>
The following options can be configured:
| Option | Required | Type | Default | Notes |
|---|---|---|---|---|
hasCaption | No | boolean | true | Do we show a caption on the component? |
caption | No | string | Copy | The caption shown on the component. |
copiedCaption | No | string | Copied! | The caption shown when you successfully copied the field. |
resetTimeout | No | string | 3000 | The amount of milliseconds before the caption reverts from copiedCaption to caption. |
field | No | IFieldOption | @clickUri | The field whose value will be copied to the clipboard. The field name must be prefixed with @. |
altTitle | No | string | Copy | The alternate title displayed for accessibility purposes. |
hasIcon | No | string | false | Do we display an icon on the component? |
icon | No | string | clipboard | The icon displayed on the component. The component offers a couple of icons. If none of them fit your needs, you can inject an SVG element. |
iconWidth | No | number | 18 | The icon width. |
iconHeight | No | string | 18 | The icon height. |
These icons are available:
| Icon | Preview |
|---|---|
clipboard | |
copy |
If none of these icons serve your purpose, you may use your own SVG icon like so:
<span class="CoveoCopyToClipboard" data-field="@uri" data-caption="Copy" data-has-icon="true"
data-icon="<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M458.4 64.3C400.6 15.7 311.3 23 256 79.3 200.7 23 111.4 15.6 53.6 64.3-21.6 127.6-10.6 230.8 43 285.5l175.4 178.7c10 10.2 23.4 15.9 37.6 15.9 14.3 0 27.6-5.6 37.6-15.8L469 285.6c53.5-54.7 64.7-157.9-10.6-221.3zm-23.6 187.5L259.4 430.5c-2.4 2.4-4.4 2.4-6.8 0L77.2 251.8c-36.5-37.2-43.9-107.6 7.3-150.7 38.9-32.7 98.9-27.8 136.5 10.5l35 35.7 35-35.7c37.8-38.5 97.8-43.2 136.5-10.6 51.1 43.1 43.5 113.9 7.3 150.8z'></path></svg>"
data-icon-height="20" data-icon-width="20"></span>
Avoid self-closing tags for maximum compatibility.
Extending the component can be done as follows:
import { CopyToClipboard, ICopyToClipboardOptions } from "@coveops/copy-to-clipboard";
export interface IExtendedCopyToClipboardOptions extends ICopyToClipboardOptions {}
export class ExtendedCopyToClipboard extends CopyToClipboard {}
.env.dist to .env and update the COVEO_ORG_ID and COVEO_TOKEN fields in the .env file to use your Coveo credentials and SERVER_PORT to configure the port of the sandbox - it will use 8080 by default.npm run buildnpm run serveFAQs
Allows the user to copy a value to their clipboard.
We found that @coveops/copy-to-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 21 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.