Skip to content

TypeScript API / @laikacms/server/oauth2 / generateQRCodeSVG

Function: generateQRCodeSVG() ​

ts
function generateQRCodeSVG(text, options?): string;

Generates an SVG string representation of a QR code for the given text.

Parameters ​

ParameterTypeDescription
textstringThe text to encode in the QR code
optionsQRCodeSVGOptionsOptional configuration for the QR code generation

Returns ​

string

An SVG string that can be embedded in HTML or saved to a file

Example ​

typescript
const svg = generateQRCodeSVG('https://example.com');
// Returns an SVG string with default options

const customSvg = generateQRCodeSVG('Hello World', {
  errorCorrection: 'H',
  border: 2,
  darkColor: '#1a1a1a',
  lightColor: '#f5f5f5'
});

Released under the MIT License.