1.0.1 • Published 1 year ago
@maksimowicz/qrcode-svg v1.0.1
QR Code svg generator
Fork of qrcode-svg with added TypeScript wrapper.
Original repo provides only minified version so obviously there is no way to add new features or fix bugs.
Example
npm install @maksimowicz/qrcode-svgimport { QRCode } from "@maksimowicz/qrcode-svg";
const svgNode = QRCode({ message: "Hello World!" });Available options
interface Props {
message: string;
size?: number;
padding?: number;
mask?: undefined | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
errorCorrectionLevel?: "L" | "M" | "Q" | "H";
errorCorrectionBoost?: boolean;
color?: [string, string],
verbose?: boolean;
}Options
- message - QR Code
message, obviously, this is mandatory parameter. - size - is equal to needed dimension (width or height) in pixels, default value is
256. - padding - white space padding, default value is
4blocks, set0for no padding. - mask - mask pattern from
0to7, if undefined suitable mask is choosen automatically - errorCorrectionLevel - error correction level:
L,M,H,Q, default value isM. - errorCorrectionBoost - error correction level boost, default value is
true, setfalseif no boost needed. - color - is array of
color,background-colorstrings that represent hex color codes, default value is'#000'along with transparent background. Set'#000','#fff'to make background opaque. - verbose - svg node is optimized to be compact and default value is
false, set this parameter totruein case you need more verbose output.