qrcode.react

A component for use with React.

  • Owner: zpao/qrcode.react
  • Platform:
  • License:: Other
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

qrcode.react

A React component to generate QR codes.

Installation

npm install qrcode.react

Usage

var React = require('react');
var QRCode = require('qrcode.react');

React.render(
  <QRCode value="http://facebook.github.io/react/" />,
  mountNode
);

Available Props

prop, type, default value
----------, ----------------------, --------------
value, string, renderAs, string ('canvas' 'svg'), 'canvas'
size, number, 128
bgColor, string (CSS color), "#FFFFFF"
fgColor, string (CSS color), "#000000"
level, string ('L' 'M' 'Q' 'H'), 'L'
includeMargin, boolean, false
imageSettings, object (see below), ### imageSettings

field, type, default value
-----------, ----------------------, --------------
src, string, x, number, none, will center
y, number, none, will center
height, number, 10% of size
width, number, 10% of size
excavate, boolean, false

Custom Styles

qrcode.react will pass through any additional props to the underlying DOM node (<svg> or <canvas>). This allows the use of inline style or custom className to customize the rendering. One common use would be to support a responsive layout.

Note: In order to render QR Codes in <canvas> on high density displays, we scale the canvas element to contain an appropriate number of pixels and then use inline styles to scale back down. We will merge any additional styles, with custom height and width overriding our own values. This allows scaling to percentages but if scaling beyond the size, you will encounter blurry images. I recommend detecting resizes with something like react-measure to detect and pass the appropriate size when rendering to <canvas>.

LICENSE ISC

Main metrics

Overview
Name With Ownerzpao/qrcode.react
Primary LanguageTypeScript
Program languageMakefile (Language Count: 3)
Platform
License:Other
所有者活动
Created At2014-03-16 22:29:59
Pushed At2025-03-29 05:18:58
Last Commit At
Release Count30
Last Release Namev4.2.0 (Posted on 2024-12-11 09:21:25)
First Release Namev0.1.1 (Posted on )
用户参与
Stargazers Count4.1k
Watchers Count24
Fork Count340
Commits Count271
Has Issues Enabled
Issues Count165
Issue Open Count22
Pull Requests Count91
Pull Requests Open Count8
Pull Requests Close Count114
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private