# Show a barcode or QR code

**URL:** <https://community.fliplet.com/t/show-a-barcode-or-qr-code/343>\
**Category:** Code Library\
**Created:** [June 30, 2022, 10:26am UTC](https://community.fliplet.com/t/show-a-barcode-or-qr-code/343 "2022-06-30T10:26:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.fliplet.com/mel/32/3_2.png) [@Mel](https://community.fliplet.com/u/Mel)\
**Post date:** [June 30, 2022, 10:26am UTC](https://community.fliplet.com/t/show-a-barcode-or-qr-code/343/1 "2022-06-30T10:26:03Z")

</div>

**Generate and display a barcode or QR code in your app**

_ **PRE-REQUISITES** _

For the following code examples to work, you will need to add the **fliplet-barcode** library to your app. To add it follow these steps:

1. When in Fliplet Studio’s Edit screen, open the Developer Options from the right hand menu
2. With the Developer Options open, click the Libraries button in the top right corner
3. In the search field, type in ‘fliplet-barcode’
4. Click it to add it to the list
5. Click Save

`Fliplet.Barcode.show()` can be used to present a barcode/QR code on the screen based on the text that has been provided (ie, the text that you want to be encoded in the barcode or QR code). By default the text is encoded into a QR code. [See here for more options](https://developers.fliplet.com/API/fliplet-barcode.html#flipletbarcodeshow).

The example below transforms ‘[https://fliplet.com](https://fliplet.com)’ into a barcode.

**JavaScript**

```javascript
var options = {
  format: 'qr',
  color: '#000000',
  background: '#ffffff',
  title: 'My QR code',
  message: 'Scan it with your camera.',
  height: 150,
  lineWidth: 2 // Only applies to barcodes
};

Fliplet.Barcode.show('https://fliplet.com', options)
  .catch(function (error) {
    // Encoding failed
    console.log(error);
  });
```
