--- 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 --- ```tsx ``` ## Usage ```tsx import { QrCode } from "@yamada-ui/react" ``` ```tsx import { QrCode } from "@/components/ui" ``` ```tsx import { QrCode } from "@workspaces/ui" ``` ```tsx ``` ### 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. |