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

react-qrcode-logo

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-qrcode-logo

React component to generate a QR Code customizable with logo and more properties

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63K
increased by4.66%
Maintainers
1
Weekly downloads
 
Created
Source

Typescript React component to generate a customizable QR Code.

Installation

npm install --save react-qrcode-logo

Usage

// import
import { QRCode } from 'react-qrcode-logo';

// usage
<QRCode value="https://github.com/gcoro/react-qrcode-logo" />

Compatibility

If you are using a React version >= 18, use react-qrcode-logo version >= 3.0.0

Props

PropTypeDefault valueDescription
valuestringhttps://reactjs.org/The value encoded in the QR Code. When the QR Code is decoded, this value will be returned
ecLevelL | M | Q | HMThe error correction level of the QR Code
enableCORSbooleanfalseEnable crossorigin attribute
sizenumber (in pixels)150The size of the QR Code
quietZonenumber (in pixels)10The size of the quiet zone around the QR Code. This will have the same color as QR Code bgColor
bgColorstring (css color)#FFFFFFBackground color
fgColorstring (css color)#000000Foreground color
logoImagestring (src attribute)The logo image. It can be a url/path or a base64 value
logoWidthnumber (in pixels)size * 0.2Logo image width
logoHeightnumber (in pixels)logoWidthLogo image height
logoOpacitynumber (css opacity 0 <= x <= 1)1Logo opacity. This allows you to modify the transparency of your logo, so that it won't compromise the readability of the QR Code
removeQrCodeBehindLogobooleanfalseRemoves points behind the logo. If no logoPadding is specified, the removed part will have the same size as the logo
logoPaddingnumberAdds a border with no points around the logo. When > 0, the padding will be visible even if the prop removeQrCodeBehindLogo is not set to true
logoPaddingStylesquare | circlesquareSets the shape of the padding area around the logo
qrStylesquares | dots | fluidsquaresStyle of the QR Code modules
eyeRadiusCornerRadii | CornerRadii[]The corner radius for the positional patterns (the three "eyes" around the QR code). See more details here
eyeColorEyeColor | EyeColor[]The color for the positional patterns (the three "eyes" around the QR code). See more details here
idstringreact-qrcode-logoOptional custom id for the QRCode canvas. You can use this prop if you have multiple QRCodes and need to differentiate them
styleReact.CSSPropertiesCSS style properties that will be applied to the canvas component

Events

Event NameReturnsDescription
logoOnLoadevent: EventEvent that fires when the QR Code logo image has been loaded

Methods

Methods must be called on a valid QRCode ref - learn more.

Method NameArgumentsDescription
downloadfileType?: 'png' | 'jpg' | 'webp', fileName?: stringThis function will download the QR Code as image. Format and file name can be specified

Example

You can find a demo project here.

Contributing

PRs and suggestions are welcome. When making a pull request, please explain in a clear way the changes you made and why you are making them (+ if you can also update the README accordingly, ty <3). Also try keep the current repo codestyle (eg. do not reformat all the code with prettier).

Thanks to everyone who contributed and/or will contribute :)

More credits

This package was inspired by cssivision/qrcode-react and zpao/qrcode.react. Also looked up some parts from kazuhikoarase/qrcode-generator (which this package depends on).

Keywords

FAQs

Package last updated on 27 May 2024

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