3.2.0 • Published 3 years ago

@bloomprotocol/qr-react v3.2.0

Weekly downloads
35
License
Apache-2.0
Repository
github
Last release
3 years ago

QR React

SVG QR Renderer For React

Installation

npm install --save @bloomprotocol/qr-react

Usage

import { QR } from '@bloomprotocol/qr-react';

const MyComponent: React.FC = (props) => {
  return (
    <QR
      data={{
        url: 'https://bloom.co',
      }}
      height={256}
      width={256}
    />
  );
};

QR Example

Props

In addition to the custom props outlined below you can provide any extra <svg> props.

NameDescriptionTypeDefault
dataThe data displayed in the QR codeRecord<string, unknown> \| string-
bgColorBackground color of the QR codestring"#ffffff00"
fgColorColor of the QR code dots and eyesstring"#6067f1"
logoConfiguration of the logo to be displayed in the center of the QR codeSee belowSee below
eyeAsOptional custom component used to render the eyes of the QRReact.ComponentType<QREyeProps>-
dotAsOptional custom component used to render the dots of the QRReact.ComponentType<QRDotProps>-

Logo Config

NameDescriptionTypeDefault
imageURL of the image to display (can be a data URL)stringSVG of the Bloom logo
widthWidth of the imagenumber20% of the QR code
heightHeight of the imagenumberwidth
opacityOpacity of the imagenumber1
import { QR } from '@bloomprotocol/qr-react';

const MyComponent: React.FC = (props) => {
  return (
    <QR
      data={{
        url: 'https://bloom.co',
      }}
      logo={{
        image: 'https://placekitten.com/200/200',
      }}
      height={256}
      width={256}
    />
  );
};