--- title: QrCode description: "`QrCode` is a component that displays a QR code." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/qr-code/qr-code.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/qr-code - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-qr-code--basic --- # QrCode `QrCode` is a component that displays a QR code. ```tsx ``` ## Usage ```tsx import { QrCode } from "@yamada-ui/react" ``` ```tsx import { QrCode } from "@/components/ui" ``` ```tsx import { QrCode } from "@workspaces/ui" ``` ```tsx ``` :::tip To display an existing QR code image, use [Image](https://yamada-ui.com/docs/components/image.md). ::: ### Change Size ```tsx {(size, index) => ( )} ``` ### Change Color Scheme ```tsx {(colorScheme, index) => ( )} ``` ### Change Color ```tsx {(color, index) => ( )} ``` ### Change Error Correction Level To change the error correction level, set `ecc` to `L`, `M`, `Q`, or `H`. ```tsx {(ecc, index) => ( )} ``` ### Use Overlay `QrCode.Overlay` can be used to place an icon on the QR code. ```tsx ``` ## Props ### QrCode.Root | Prop | Default | Type | Description | | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | `"md"` | `"2xl" \| "2xs" \| "3xl" \| "4xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs" ...` | The size of the component. | | `value` | - | `string` | The value to encode as a QR code. | | `boostEcc` | `false` | `boolean` | The error correction level to boost the error correction level to the maximum allowed by the version and size. | | `border` | `1` | `number` | The border width around the QR code. | | `ecc` | `"L"` | `"H" \| "L" \| "M" \| "Q"` | The error correction level. - `L` allows for up to 7% error correction, - `M` allows for up to 15% error correction, - `Q` allows for up to 25% error correction, - `H` allows for up to 30% error correction. | | `frameProps` | - | `QrCodeFrameProps` | Props for the frame component. | | `invert` | `false` | `boolean` | Inverts the black and white of the QR code. | | `maskPattern` | `-1` | `number` | The mask pattern to use. | | `maxVersion` | `40` | `number` | The maximum version of the QR code (1-40). | | `minVersion` | `1` | `number` | The minimum version of the QR code (1-40). | | `onEncoded` | - | `(qr: QrCodeGenerateResult) => void` | Callback function to receive the generated QR Code. | | `patternProps` | - | `QrCodePatternProps` | Props for the pattern component. | | `pixelSize` | `10` | `number` | The pixel size of the QR code. | ### QrCode.Frame | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### QrCode.Overlay | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### QrCode.Pattern | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Similar Components - [Image](https://yamada-ui.com/docs/components/image.md): `Image` is a component that displays images. - [NativeTable](https://yamada-ui.com/docs/components/native-table.md): `NativeTable` is a component for efficiently organizing and displaying data. - [Picture](https://yamada-ui.com/docs/components/picture.md): `Picture` is a component that uses the `picture` element to provide alternative images for different display and device scenarios. - [Stat](https://yamada-ui.com/docs/components/stat.md): `Stat` is used to display numbers or data within a box. - [Table](https://yamada-ui.com/docs/components/table.md): `Table` is a table component equipped with column sorting, row selection, and click event features. - [AreaChart](https://yamada-ui.com/docs/components/area-chart.md): `AreaChart` is a component for drawing area charts to compare multiple sets of data. - [AspectRatio](https://yamada-ui.com/docs/components/aspect-ratio.md): `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio. - [Badge](https://yamada-ui.com/docs/components/badge.md): `Badge` is a component that emphasizes the status of an item to make it immediately recognizable.