0.1.6 • Published 3 months ago

svelte-barcode-scanner v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Svelte Barcode Scanner

A Svelte component for detecting QR-codes, EAN-barcodes and other barcode formats.

NPM Type Definitions NPM Version GitHub Actions Workflow Status GitHub License

Installation

npm install svelte-barcode-scanner

or

pnpm add svelte-barcode-scanner

Usage

<script lang="ts">
	import { BarcodeScanner } from 'svelte-barcode-scanner';
</script>

<BarcodeScanner />

The <BarcodeScanner /> component is responsive and fills the available space with object-fit: cover.

This enables you to embed the component inside a div with a fixed aspect ratio to get a predictable size regardless of the aspect ratio of the camera feed:

<script lang="ts">
	import { BarcodeScanner } from 'svelte-barcode-scanner';
</script>

<div class="barcode-scanner">
	<BarcodeScanner />
</div>

<style>
	.barcode-scanner {
		width: 100%;
		max-width: 384px;
		aspect-ratio: 1;
	}
</style>

A live demo and an API reference is being worked on.

License

MIT

0.1.6

3 months ago

0.1.5

3 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

4 months ago

0.1.1

4 months ago

0.1.0

4 months ago