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

ak-barcode-scanner

v1.0.17

Published

Componente React para escanear códigos de barras y QR usando la cámara del dispositivo, basado en [html5-qrcode](https://github.com/mebjas/html5-qrcode) y Material UI.

Downloads

22

Readme

BarcodeScanner Component

Componente React para escanear códigos de barras y QR usando la cámara del dispositivo, basado en html5-qrcode y Material UI.

Dependencias

Instala las dependencias necesarias:

npm install react @mui/material @mui/icons-material html5-qrcode
# o
yarn add react @mui/material @mui/icons-material html5-qrcode

Instalación

Copia el archivo BarcodeScanner.tsx a tu proyecto o instala el paquete si está publicado.

Uso Básico

import BarcodeScanner from './BarcodeScanner';

function App() {
  const handleDetected = (code: string) => {
    alert(`Código detectado: ${code}`);
  };

  return (
    <div>
      <BarcodeScanner onDetected={handleDetected} />
    </div>
  );
}

Props

| Prop | Tipo | Requerido | Descripción | Default | |----------------|------------------------|-----------|----------------------------------------------------------------------------------------------|-----------------| | onDetected | (code: string) => void | Sí | Callback que se ejecuta cuando se detecta un código. | — | | iconColor | string | No | Color del ícono del botón. | #fff | | icon | React.ReactNode | No | Ícono personalizado para el botón. | Cámara (MUI) | | modalColor | string | No | Color de fondo del modal. | #ffffff | | buttonColor | string | No | Color de fondo del botón. | #1976d2 | | buttonSx | object | No | Estilos adicionales para el botón (prop sx de MUI). | {} |

Ejemplo con opciones personalizadas

<BarcodeScanner
  onDetected={(code) => console.log('Detectado:', code)}
  iconColor="#222"
  icon={<CustomIcon />}
  modalColor="#f5f5f5"
  buttonColor="#ff9800"
  buttonSx={{ boxShadow: 3 }}
/>

Características

  • Selección de cámara si hay más de una disponible (frontal/trasera).
  • Modal personalizable con Material UI.
  • Escaneo rápido y eficiente de códigos de barras y QR.
  • Manejo de errores y permisos de cámara.
  • Fácil integración y personalización.

Notas

  • El componente solicita permisos de cámara al abrir el modal.
  • Si el usuario deniega el permiso o no hay cámaras disponibles, se muestra un mensaje de error.
  • El escaneo se detiene automáticamente al cerrar el modal o al detectar un código.

Créditos