zmp-qrcode
v3.0.0
Published
React component for generating QR Code that match Zalo Miniapps looks and feels.
Downloads
54
Maintainers
Readme
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" />
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.