New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-qrcode-pretty

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-qrcode-pretty

Qrcode generator for react apps with many customization options

latest
Source
npmnpm
Version
3.3.1
Version published
Weekly downloads
1.8K
-0.86%
Maintainers
1
Weekly downloads
 
Created
Source

react-qrcode-pretty

pages-build-deployment downloads npm

Qrcode generator for react apps with many customization options.

Qrcode example

Qrcode generator website

Installation

Run the command below in the terminal to install react-qrcode-pretty in your project

npm i react-qrcode-pretty

Or with Yarn

yarn add react-qrcode-pretty

Resources

  • QrcodeCanvas: React Element to generate a Qrcode with canvas.
  • QrcodeSVG: React Element to generate a Qrcode with SVG.
  • useQrcodeDownload: React Hook to download Qrcode in browser.

Qrcode Props

PropTypeDefaultDetails
valuestringQrcode payload (required)
sizenumberautoSize of the qrcode without margin and padding
colorstring
{ 'eyes': string, 'body': string }
'#000000'Foreground color for the entire qrcode or for each part (eyes and body) of the qrcode
colorEffectgradient-dark-vertical
gradient-dark-horizontal
gradient-dark-diagonal
gradient-light-vertical
gradient-light-horizontal
gradient-light-diagonal
colored
shades
none
{ 'eyes': colorEffect, 'body': colorEffect }
'none'Apply effects to coloring
modeNumeric
Alphanumeric
Byte
Kanji
'Byte'Mode that payload (value) will be logged
levelL
M
Q
H
'M'Error correction level
modules[0-40]0Number of qrcode modules. 0 is auto
imagestring
{ src: string; width ?: number; height ?: number; positionX ?: number; positionY ?: number; overlap ?: boolean; }
undefinedSettings for the image to be inserted into the qrcode
marginnumber0Margin size. Area without background color
paddingnumber0Padding size. Area with background color
variantstandard
rounded
dots
circle
fluid
reverse
shower
gravity
morse
italic
inclined
{ 'eyes': variant, 'body': variant }
'standard'Style applied to the entire qrcode or each part (eyes and body) of it
dividerbooleanfalseActive a small separation between the qrcode body points
bgColorstring'#FFFFFF'Background color
bgRoundedbooleanfalseBackground color rounded
internalPropsHTMLAttributes<HTMLCanvasElement | SVGSVGElements>undefinedThe internal props attributes
onReady(element : HTMLCanvasElement | SVGSVGElements) => voidundefinedProvides element properties and methods when available. To be used with the useQrcodeDownload hook.

Code Example

import {
    QrcodeCanvas, 
    useQrcodeDownload
} from "react-qrcode-pretty";

export function QrcodeCustom({ value = 'react-qrcode-pretty' }) {

    const [ setQrcode, download, isReady ] = useQrcodeDownload();

    return (

        <div>

            <QrcodeCanvas
                value={ value }
                variant={{
                    eyes: 'gravity',
                    body: 'fluid'
                }}
                color={{
                    eyes: '#223344',
                    body: '#335577'
                }}
                padding={ 20 }
                margin={ 20 }
                bgColor='#ddeeff'
                onReady={ setQrcode }
                bgRounded
                divider
            />

            <br />

            <button
                onClick={ () => download('qrcode_file_name') }
                disabled={ !isReady }
            >Download Qrcode</button>

        </div>

    );

}

export default QrcodeCustom;

Try it in the code sandbox

Qrcode Examples

Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example Qrcode example

Qrcode generator website

Author

License

This project is under the MIT license - see file LICENSE for details.

Keywords

react

FAQs

Package last updated on 08 Jul 2025

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