npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@getsoftwareco/get-qr-react

v1.0.1

Published

A modern, lightweight and customizable QR code scanner component for React.

Readme

📸 GetSoftwareCo QR React

npm version npm downloads License: MIT Powered by GetSoftwareCo

A modern, lightweight, and fully customizable QR & Barcode scanner for React.

Built on top of html5-qrcode, this library solves common issues like ugly default UIs, lack of flashlight support, and complex camera management. It provides a plug-and-play component with a beautiful interface and a headless hook for total control.


🚀 Features

  • 🎨 Modern Custom UI: No more outdated default buttons. Comes with a sleek, rounded, and mobile-friendly interface.
  • 🔦 Flashlight / Torch Support: Essential for logistics and dark environments (Supports toggle on/off).
  • 🔄 Camera Switching: Easily switch between Front and Back cameras.
  • 🛒 Multi-Format Support: Scans QR Codes, EAN-13, UPC, Code 128, and more.
  • ⚛️ Headless Hook: Use useScanner to build your own UI from scratch.
  • 🛡️ TypeScript Ready: Fully typed for a great developer experience.
  • 📱 Responsive: Works perfectly on mobile and desktop devices.

📦 Installation

npm install @getsoftwareco/get-qr-react

or

yarn add @getsoftwareco/get-qr-react

Note: This package requires react and react-dom (v16.8+).

💻 Usage

  1. Basic Usage (Plug & Play) The easiest way to add a scanner to your app.
import React from 'react';
import { GetQR } from '@getsoftwareco/get-qr-react';

const App = () => {
  return (
    <div style={{ padding: 20 }}>
      <h1>QR Scanner Demo</h1>
      
      <GetQR 
        onScanSuccess={(code, result) => {
          console.log("Scanned Code:", code);
          alert(`Scanned: ${code}`);
        }}
        onScanFailure={(error) => {
          // console.warn(error); // Optional
        }}
      />
    </div>
  );
};

export default App;
  1. Advanced Usage (Barcodes & Flashlight) Perfect for inventory, logistics, or supermarket apps.
import React from 'react';
import { GetQR, Html5QrcodeSupportedFormats } from '@getsoftwareco/get-qr-react';

const InventoryScanner = () => {
  return (
    <GetQR 
      // Only scan specific barcodes to improve performance
      formatsToSupport={[
        Html5QrcodeSupportedFormats.QR_CODE,
        Html5QrcodeSupportedFormats.EAN_13, // Product Barcodes
        Html5QrcodeSupportedFormats.CODE_128, // Logistics
      ]}
      onScanSuccess={(code) => console.log("Product found:", code)}
      
      // Custom Styles
      containerStyle={{ width: '100%', maxWidth: '500px', borderRadius: 20 }}
      showControls={true} // Shows Play/Pause, Switch Camera, and Flashlight buttons
    />
  );
};
  1. Headless Mode (Custom UI) 🛠️ Want to build your own interface? Use the useScanner hook.
import { useScanner } from '@getsoftwareco/get-qr-react';

const MyCustomScanner = () => {
  const { 
    startScan, 
    stopScan, 
    isScanning, 
    toggleTorch, 
    isTorchOn,
    activeCameraId 
  } = useScanner("my-custom-reader-id", (code) => console.log(code));

  return (
    <div>
      <div id="my-custom-reader-id" style={{ width: 300, height: 300 }} />
      
      <div className="controls">
        <button onClick={startScan} disabled={isScanning}>Start</button>
        <button onClick={stopScan} disabled={!isScanning}>Stop</button>
        <button onClick={toggleTorch}>
            {isTorchOn ? "Turn Off Light" : "Turn On Light 🔦"}
        </button>
      </div>
    </div>
  );
};

Scanner Component

⚙️ Props & Configuration

| Prop | Type | Default | Description | |-------------------|------------------|--------------|-----------------------------------------------------------------------------| | onScanSuccess | function | Required | Callback when a code is successfully scanned. | | onScanFailure | function | undefined | Callback when scanning fails (triggered on every frame). | | startOnMount | boolean | true | Automatically start the camera when component mounts. | | showControls | boolean | true | Show the built-in modern control panel (Start/Stop, Torch, Switch). | | formatsToSupport| Array | All | Array of formats (QR, EAN, UPC...) to scan. | | fps | number | 10 | Frames per second. Lower saves battery. | | qrbox | number | 250 | Size of the scanning focus area (px). | | disableFlip | boolean | false | Disable mirroring for front camera. | | containerStyle | CSSProperties | {} | Style object for the main wrapper. |

🏗️ Supported Formats

This package supports all major 1D and 2D code formats:

2D Formats

  • QR Code
  • Data Matrix
  • Aztec
  • PDF417

1D Formats

  • EAN-13
  • EAN-8
  • UPC-A
  • UPC-E
  • Code 128
  • Code 39
  • Code 93
  • ITF

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue for bugs and feature requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License – see the LICENSE file for details.