# QR codes

A QR code (Quick Response code) is a two-dimensional barcode that can be scanned using a smartphone camera or QR code reader. QR codes are similar to traditional barcodes, but they can store much more information and can be scanned much more quickly.

They are often used to store website URLs, contact information, or other types of data that can be easily accessed by scanning the code.&#x20;

Codes can be placed on business cards, brochures, advertisements, or other marketing materials. They can also be used in other ways such as for mobile payments, ticketing, and much more. They can also be used to track inventory and assets in industries such as manufacturing and logistics.

CSS and HTML do not include built-in support for QR codes, therefore, it must be obtained from a separate package that needs to be imported specifically if you wish to use it.

To install it, use composer and require `typesetsh/qr-code-element`.

```
composer require typesetsh/qr-code-element
```

After installation, you can include the `qr-code` element in your HTML. This element supports the `alt` attribute as well as the `icon-src` and `icon-size` attributes. These can be used to place and adjust the size of an icon in the center of your QR code. The size is represented as an integer, where 1 equals one block size (a single block-bit, so to speak). The content within the `qr-code` element represents the data that will be encoded in the QR code.

```html
<qr-code icon-src="icon.png" icon-size="3">DATE_GOES-HERE</qr-code>
```

{% hint style="warning" %}
Please be aware that white spaces are not automatically removed. If you are adding multi-line content for encoding, make sure to avoid using tabs or white spaces for code indentation, as these will also be encoded in the QR code.
{% endhint %}

{% embed url="<https://typeset.sh/en/live-demo/qr-code>" %}

### Attributes

| Attribute                   | Default | Description                                                                                                         |
| --------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| data-error-correction-level | Q       | <p>Possible values: <br>L: \~7% correction<br>M: \~15% correction<br>Q: \~25% correction<br>H: \~30% correction</p> |
| data-encoding               | UTF-8   | Valid encoding, default UTF-8                                                                                       |
| icon-src                    |         | Any image url                                                                                                       |
| icon-size                   | 0       | The size of the icon in bit unit. 1 equals the size of 1 square.                                                    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.typeset.sh/advanced-guides/qr-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
