1.0.7 ā€¢ Published 4 years ago

react-hook-qrcode v1.0.7

Weekly downloads
125
License
MIT
Repository
github
Last release
4 years ago

react-hook-qrcode

React hooks for generating QR code.

NPM downloads npm bundle size Build Status JavaScript Style Guide

šŸŽ Features

  • Render as Canvas & Image
  • Support Numeric, Alphanumeric, Kanji and Byte mode
  • Support Japanese, Chinese, Greek and Cyrillic characters
  • Support multibyte characters (like emojis smile)

Live Demo

šŸ”§ Install

react-hook-qrcode is available on npm. It can be installed with the following command:

npm install --save react-hook-qrcode

react-hook-qrcode is available on yarn as well. It can be installed with the following command:

yarn add react-hook-qrcode

šŸ’” Canvas

usage

import React from 'react';
import { useQRCode } from 'react-hook-qrcode';

function App() {
  const [inputRef] = useQRCode({
    text: 'https://github.com/bunlong/react-hook-qrcode',
    options: {
      level: 'M',
      margin: 7,
      scale: 1,
      width: 200,
      color: {
        dark: '#010599FF',
        light: '#FFBF60FF',
      },
    },
  });
  
  return <canvas ref={inputRef} />;
};

export default App;

parameters

options

šŸ’” Image

usage

import React from 'react';
import { useQRCode } from 'react-hook-qrcode';

function App() {
  const [inputRef] = useQRCode({
    text: 'https://github.com/bunlong/react-hook-qrcode',
    options: {
      type: 'image/jpeg',
      quality: 0.3,
      level: 'M',
      margin: 3,
      scale: 4,
      width: 200,
      color: {
        dark: '#010599FF',
        light: '#FFBF60FF',
      },
    },
  });
  
  return <img ref={inputRef} />;
};

export default App;

parameters

options

šŸ’– Wrap Up

If you think any of the react-hook-qrcode can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

šŸŒŸ Contribution

We'd love to have your helping hand on contributions to react-hook-qrcode by forking and sending a pull request!

Your contributions are heartily ā™” welcome, recognized and appreciated. (āœæā— ā€æā— )

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

āš–ļø License

The MIT License License: MIT