Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/f36-copybutton

Package Overview
Dependencies
Maintainers
100
Versions
344
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/f36-copybutton

Forma 36: CopyButton component

  • 4.0.1-next-v4-6289.2215
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
decreased by-14.91%
Maintainers
100
Weekly downloads
 
Created
Source

title: 'CopyButton' type: 'component' status: 'stable' slug: /components/copy-button/ github: 'https://github.com/contentful/forma-36/tree/master/packages/components/copybutton' storybook: 'https://f36-storybook.contentful.com/?path=/story/components-copybutton--default' typescript: ./src/CopyButton.tsx

import { Props } from '@contentful/f36-docs-utils'; import { CopyButton } from '@contentful/f36-copybutton';

The CopyButton is a styled button that copies text into the user's clipboard. This is useful in combination with for example tables or inputs that show values that the user is likely to use elsewhere, such as automatically generated passwords.

Table of contents

How to use CopyButton

CopyButton can be used in combination with text inputs where the input value should be easy to copy. In such cases it is best to position the CopyButton at the end of the input.

Code examples

// import { CopyButton } from '@contentful/f36-copybutton';

<CopyButton value="Lorem Ipsum" />

An example with a custom tooltip:

// import { CopyButton } from '@contentful/f36-copybutton';

<CopyButton
  value="Lorem Ipsum"
  tooltipCopiedText="The text has been copied"
  tooltipText="Copy this text to clipboard"
/>

An example with custom tooltip placement and custom aria-label.

// import { CopyButton } from '@contentful/f36-copybutton';

<CopyButton
  value="Lorem Ipsum"
  tooltipCopiedText="The text has been copied"
  tooltipText="Copy this text to clipboard"
  label="Copy 'Lorem Ipsum'."
  tooltipProps={{ placement: 'bottom', usePortal: true }}
/>

Accessibility

You can pass a custom aria-label through the label prop.

Props

FAQs

Package last updated on 17 Aug 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc