๐ก Image
๐จโ๐ป Code
import React from 'react'
import { useQRCode } from 'next-qrcode'
function App() {
const { Image } = useQRCode()
return (
<Image
text={'https://github.com/bunlong/next-qrcode'}
options={{
type: 'image/jpeg',
quality: 0.3,
errorCorrectionLevel: 'M',
margin: 3,
scale: 4,
width: 200,
color: {
dark: '#010599FF',
light: '#FFBF60FF',
},
}}
/>
)
}
export default App
๐ Props
Prop | Type | Require | Description |
---|---|---|---|
text | string | โ๏ธ | Text/URL to encode. |
options | object | โ | QR code options. |
๐ Options
Prop | Type | Default | Require | Description |
---|---|---|---|---|
errorCorrectionLevel | string | M | โ | Correction level. Possible values are low , medium , quartile , high or L , M , Q , H . |
margin | number | 4 | โ | Define how much wide the quiet zone should be. |
scale | number | 4 | โ | Scale factor. A value of 1 means 1px per modules (black dots). |
width | number | 4 | โ | Forces a specific width for the output image. If width is too small to contain the qr symbol, this option will be ignored. Takes precedence over scale . |
color.dark | string | #000000ff | โ | Color of dark module. Value must be in hex format (RGBA). Note: dark color should always be darker than color.light . |
color.light | string | #ffffffff | โ | Color of light module. Value must be in hex format (RGBA). |