export const title = "QR code components" export const description = "Free and open-source React QR code components built for modern applications and websites. This component is built using QR Code Styling library and styled with Tailwind CSS." export const links = { github: "https://github.com/untitleduico/react/tree/main/components/shared-assets/qr-code", } import { QRCode, GradientScan } from "@/components/shared-assets/qr-code.tsx"; ```jsx import { QRCode } from '@/components/shared-assets/qr-code'; ``` ## Installation You can add this QR code component using our CLI or manually: ```bash npx untitledui@latest add qr-code ``` As our QR code component is built with [qr-code-styling](https://qr-code-styling.com/), you'll need to install the dependencies: ```bash npm install qr-code-styling ``` Copy the files below into your project: Great! Now you can start using the QR code component in your project by just copy/pasting our examples below. ## QR code examples Below are examples and variations of this QR code component: ### Default In order to use the default QR code, you can simply import the component and pass the value you want to encode in the QR code via the `value` prop. ```jsx import { QRCode } from '@/components/shared-assets/qr-code'; ``` ### Large You can change the size of the QR code by passing the `size` prop. For example, to use a large QR code, you can pass `size="lg"` to the component. ```jsx import { QRCode } from '@/components/shared-assets/qr-code'; ``` ### With gradient scan You can add a gradient scan effect to the QR code by passing using the `GradientScan` component together with the `QRCode` component.
```jsx import { QRCode, GradientScan } from '@/components/shared-assets/qr-code';
```
### With custom options The QR code component is built using [QR Code Styling](https://github.com/kozakdenys/qr-code-styling) library, which provides a lot of customization options. For example, to add an image to the QR code, you can pass your image URL to the `options.image`. To see the full list of options, please refer to the [QR Code Styling documentation](https://github.com/kozakdenys/qr-code-styling?tab=readme-ov-file#api-documentation). ```jsx import { QRCode } from '@/components/shared-assets/qr-code'; ```