# Barcode Scanner

## Barcode Scanner Overview

Barcodes and QR codes can be useful features in many types of apps from social apps like WeChat and Venmo to connect friends together or location-based games like scavenger hunts. The Barcode Scanner component uses the camera to read any barcode or QR code.

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-LrzPls4vMXy3ftzxSqz%2F-LrzTfZSt5g5UGaqJ0za%2FThunkable%20Play%20Store%20Screenshots%20\(1080%20x%201920\)%20\(17\).png?alt=media\&token=54fd48bd-cd2c-46b2-9ac4-2b0f26524de0)

## Blocks

The Barcode Scanner is among the easiest components to set-up and use. After adding the component to your app, you can connect it with a button and a label like the blocks below.

### Scan

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MYdT3BkkSRYEv-BEw56%2F-MYdTL2QACD34cpd62Fe%2FScreen%20Shot%202021-04-19%20at%2010.32.23%20AM.png?alt=media\&token=5b6156f8-1103-42ab-a6c4-cff090790b31)

#### Outputs

| Name          | Data Type  | Data                                                           |
| ------------- | ---------- | -------------------------------------------------------------- |
| value         | text       | value from scanned barcode/QR code                             |
| type          | text       | `barcode` or `QR code`                                         |
| was cancelled | True/False | If user cancelled action, returns `true`; else returns `false` |
| error         | Text       | If error, returns error; else returns `null`                   |

In most cases you'll use the default `back` camera in your mobile device but you also have the option to specify the front camera in certain cases.

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-LrzPls4vMXy3ftzxSqz%2F-LrzVi3yZGE1MRi_HsXC%2FScreen%20Shot%202019-10-24%20at%201.43.37%20PM.png?alt=media\&token=f5e44e5a-2464-4cf6-b768-82a9dafc3b71)
