2.0.12 • Published 9 months ago
react-qr-code v2.0.12
react-qr-code
A component for React. This library works with React and React Native (using React Native SVG).
Screenshots
Web
Android & iOS
Installation
npm i react-qr-code
When using this library with React Native, you will also need to have react-native-svg
installed.
npm i react-native-svg
cd ios && pod install
The Gist
import React from "react";
import ReactDOM from "react-dom";
import QRCode from "react-qr-code";
ReactDOM.render(<QRCode value="hey" />, document.getElementById("Container"));
Note: If the QR code is likely to appear next to dark objects, you will need to wrap it in a light-colored container to preserve the 'quiet zone', e.g.
<div style={{ background: 'white', padding: '16px' }}>
<QRCode ... />
</div>
Responsive QR code example:
// Can be anything instead of `maxWidth` that limits the width.
<div style={{ height: "auto", margin: "0 auto", maxWidth: 64, width: "100%" }}>
<QRCode
size={256}
style={{ height: "auto", maxWidth: "100%", width: "100%" }}
value={value}
viewBox={`0 0 256 256`}
/>
</div>
API
prop | type | default value |
---|---|---|
bgColor | string | '#FFFFFF' |
fgColor | string | '#000000' |
level | string ('L' 'M' 'Q' 'H' ) | 'L' |
size | number | 256 |
title | string | |
value | string |
License
MIT
2.0.12
9 months ago
2.0.11
1 year ago
2.0.9
1 year ago
2.0.10
1 year ago
2.0.8
2 years ago
2.0.7
2 years ago
2.0.6
2 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.3
2 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.1.3
5 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.1-rc.7
8 years ago
0.0.1-rc.6
8 years ago
0.0.1-rc.5
8 years ago
0.0.1-rc.4
8 years ago
0.0.1-rc.3
8 years ago
0.0.1-rc.2
8 years ago
0.0.1-rc.1
8 years ago