viewfinder-component
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Built With Stencil

Viewfinder web component for barcode scanning.

screenshot

Online barcode scanner demo

Usage

In your HTML, add the component:

<view-finder></view-finder>

You can define the width, the height, the scan region and the styles like this:

<view-finder 
  style="--scan-line-color:orange;
         --scan-rect-color:orange;"
  width="1280"
  height="720"
  left="320"
  right="960"
  top="180"
  bottom="540"
  preserve-aspect-ratio="xMidYMid slice">
</view-finder>

Install this component

Script tag

  • Put a script tag similar to this

    <script type="module">
      import { defineCustomElements } from 'https://cdn.jsdelivr.net/npm/viewfinder-component/dist/esm/loader.js';
      defineCustomElements();
    </script>

    in the head of your index.html

  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install viewfinder-component --save

  • Put a script tag similar to this

    <script type="module">
      import { defineCustomElements } from 'node_modules/viewfinder-component/dist/esm/loader.js';
      defineCustomElements();
    </script>

    in the head of your index.html

  • Then you can use the element anywhere in your template, JSX, html etc

Package Sidebar

Install

npm i viewfinder-component

Weekly Downloads

29

Version

0.2.0

License

MIT

Unpacked Size

309 kB

Total Files

45

Last publish

Collaborators

  • xulihang