Help

Re: Copy to Clipboard functionality similar to the Color Palette Block

529 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Lea_Marolt_Sonn
4 - Data Explorer
4 - Data Explorer

Hi!

I’m curious if anyone know how to implement a copy-to-clipboard in an Airtable Block that’s similar to how this Color Palette works, https://support.airtable.com/hc/en-us/articles/115013249087-Color-palette-block .

I’m hoping to make different lines of text clickable to facilitate fast copy & pasting of code snippets.

3 Replies 3

Hi! This might be helpful: GitHub - nkbt/react-copy-to-clipboard: Copy-to-clipboard React component

You can use that in your custom block. Since this thread is in the “Scripting block” category, just want to clarify that it’s not currently possible to use external packages in the scripting block.

That is helpful for custom blocks.

In case someone is doesn’t known too much about coding from the package above you need:

import {CopyToClipboard} from 'react-copy-to-clipboard';

<CopyToClipboard text={variableToCopy}> 

                <Button icon="clipboard"  maxWidth="20">

                Copy this

                </Button>

            </CopyToClipboard>

That makes it pretty straightforward to copy text to the clipboard.

Mike_Pennisi
7 - App Architect
7 - App Architect

I’ve relocated this post to the “Custom Blocks Beta” category so that it’s easier for others to find.