elzii / figma-hooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Figma Hooks

WIP

useCopyToClipboard

Leverages deprecated document.execCommand in the absence of a Clipboard API

import * as React from 'react'
import { useCopyToClipboard } from 'figma-hooks'

export default function Example() {
  const { copy } = useCopyToClipboard({
    contents: 'Some stuff',
    logger: console,
  })

  return (
    <div>
      <h1>Copy to Clipboard</h1>
      <button type='button' onClick={copy}>
        Copy
      </button>
    </div>
  )
}

About

License:ISC License


Languages

Language:TypeScript 100.0%