DocsComponentsTemplatesThemesGitHub

CopyButton

Icon button that copies text to the clipboard and confirms with a check.

Code

import * as React from 'react';
import { CopyButton } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        alignItems: 'center',
        gap: 8,
        fontFamily: 'ui-monospace,monospace',
        fontSize: 14,
      }}
    >
      proj_8f2c91
      <CopyButton text="proj_8f2c91" />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { CopyButton } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/copy-button.json

Guidelines

  • Use next to code, IDs, links and API keys (masked).

Props

PropTypeRequired
textstringYes
labelstringNo
variant'plain' | 'gray' | 'tinted'No
classNamestringNo

Edit this example on GitHub