zmp-qrcode
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

ZMP QR Code

React component for generating QR codes that match Zalo Mini App looks and feels.

Installation

npm i zmp-qrcode

Usage

import { QRCode } from 'zmp-qrcode'

<QRCode value="https://www.npmjs.com/package/zmp-qrcode" />

Preview

API Documentation

QRCode

Props

Name Description Default
value* string -
size number 128

Ref

You can export the QR code as a base64 image using ref. Here is an example:

export const Base64 = (args) => {
  const ref = useRef<QRCodeInstance>()
  const [src, setSrc] = useState('');

  return <div>
    <QRCode ref={el => el ? setTimeout(() => setSrc(el.getBase64()), 1000) : el} {...args} rounded />
    <img src={src} alt="" />
  </div>
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Package Sidebar

Install

npm i zmp-qrcode

Weekly Downloads

61

Version

3.0.0

License

MIT

Unpacked Size

779 kB

Total Files

10

Last publish

Collaborators

  • nguyenhongphat0