2.1.3 • Published 6 years ago
the-qr v2.1.3
the-qr
QRCode the-component
Installation
$ npm install the-qr --save
Usage
Live Demo is hosted on GitHub Page
'use strict'
import React from 'react'
import { TheQr, TheQrStyle } from 'the-qr'
import { TheSpinStyle } from 'the-spin'
class ExampleComponent extends React.PureComponent {
render () {
return (
<div>
<TheSpinStyle/>
<TheQrStyle/>
<TheQr text={null}></TheQr>
<TheQr text={'Some URL'}
onError={ (err) => console.error('Failed with error:', err)}
onGenerate={ (url) => console.log('Image generated:', url)}
></TheQr>
<br/>
<TheQr text={'Some URL as Link'}
onError={ (err) => console.error('Failed with error:', err)}
onGenerate={ (url) => console.log('Image generated:', url)}
asLink
></TheQr>
<TheQr text={'With display size'}
displaySize={24}
onError={ (err) => console.error('Failed with error:', err)}
onGenerate={ (url) => console.log('Image generated:', url)}
asLink
></TheQr>
</div>
)
}
}
export default ExampleComponent
Components
TheQr
QRCode the-component
Props
Name | Type | Description | Default |
---|---|---|---|
alt | string | Alt text | 'NO TEXT FOUND' |
asLink | bool | Render as Link | false |
onError | func | Handle error | (err) => console.error(err) |
onGenerate | func | Handle image generate | () => {} |
size | number | QRCode size | 256 |
text | string | Text to render as QR | '' |
displaySize | null |
TheQrStyle
Style for TheQr
Props
Name | Type | Description | Default |
---|---|---|---|
options | object | Style options | {} |
License
This software is released under the MIT License.