Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@devmehq/react-qr-code

Package Overview
Dependencies
Maintainers
1
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devmehq/react-qr-code

React component to generate QR codes

  • 1.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
increased by15.41%
Maintainers
1
Weekly downloads
 
Created
Source

@devmehq/react-qr-code

Simple & Advanced React component to generate QR codes

NPM version Build Status Downloads UNPKG

Edit react-qr-code-demo

Installation

npm install @devmehq/react-qr-code
yarn install @devmehq/react-qr-code

Usage

import React from 'react';
import { ReactQrCode } from '@devmehq/react-qr-code';

<ReactQrCode value="http://facebook.github.io/react/" />
var React = require('react');
var { ReactQrCode } = require('@devmehq/react-qr-code');

<ReactQrCode value="http://facebook.github.io/react/" />

Available Props

proptypedefault value
valuestring
renderAsstring ('canvas' 'svg')'canvas'
sizenumber128
bgColorstring (CSS color)"#FFFFFF"
fgColorstring (CSS color)"#000000"
levelstring ('L' 'M' 'Q' 'H')'L'
marginSizenumberfalse
imagesarray (see below)

imageSettings

fieldtypedefault value
srcstring
xnumbernone, will center
ynumbernone, will center
heightnumber10% of size
widthnumber10% of size
excavatebooleanfalse

Custom Styles

@devmehq/react-qr-code 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>.

qrcode-demo

TODO

  • Add Image Ref
  • Add Corner Images and Center Image
  • Add Examples to wifi password, 2fa, and other QR codes
  • ADD SSR Rendering Support
  • Add Download / Share QR Code
  • Add Test

LICENSE MIT

Keywords

FAQs

Package last updated on 11 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc