react-code-copy-block
Installation
Install with:
npm install --save react-code-copy-block
Usage
; ... { return <div> ... <ReactCodeCopyBlock sLanguage="javascript"> var array1 = 'a' 'b' 'c'; array1; </ReactCodeCopyBlock> </div> }
Description
A useful React component that combines react-copy-to-clipboard
, react-toastify
, and react-syntax-highlighter
to bring you copiable code snippets with popup feedback:
Works on Desktop, Mobile, and Tablet - the styles will make it so that the code field fills the width of it's container! (Looks nicest within fixed with or max-width containers.)
Works great in Gatsby JS blogs! (At least for .js style posts; won't work in markdown posts of course!)
Styling
Styles are Monokai-ish and with default as follows: