✨?️ React Highlight ✨?️

React component for highlighting js and jsx code with copy to clipboard functionallity.

npm latest package
install size Build Status
Known Vulnerabilities
Language grade: JavaScript
Total alerts

Sample result:

Sample result image


react-highlight is available as an npm package.

// with npm
npm i rc-highlight

// or yran
yarn add rc-highlight


Here is a quick example to get you started, it’s all you need:

Edit Button

import "./styles.css";
import { Highligther } from "rc-highlight";

const App = (props) => {
  return <Highlighter>{makeCode}</Highlighter>;
export default App;
const makeCode = `
    // this is a sample code
    const themes = {
      light: { ... },
      dark:  { ... }
    const ThemeContext = React.createContext(themes.light);
    function App() {
      return (
        <ThemeContext.Provider value={themes.dark}>
          <Toolbar />
    function Toolbar(props) { ... }
    const ThemedButton =() => { ... }


Name Description Default
code The JSX code to be highlighted. “”
style The in-line CSS object. Only affects the container { }
children The JSX code to be highlighted in string format. “”
onCopyToClipboard A Funtion that is triggered when copy to clipboard button is clicked. Returns the copied code as a string as first parameter. undefined


This project is licensed under the terms of the
MIT license.


View Github