Build / Atoms
QRCode
A QR code — the matrix, plated, with the mark in the middle.
Deck encodes nothing. This draws a code you supply, either as src or as
inline SVG, which is why there is no QR library in the dependency list and
why src/components stays dependency-free. Generate the code upstream.
It draws only the code. It used to also carry a caption above and the URL beneath, which made an atom responsible for the layout around it — three jobs, and two of them the parent's. The surfaces that need a heading or a readable link compose them.
import { QRCode } from '@meetcard/deck'Example
<QRCode value="meetcard.io/ben@meetcard" size="lg"> <MatrixSvg /> </QRCode>Stories
The mark sits in the centre the generator reserved for it.
Source
const Default = () => <QRCode value="meetcard.io/ben@meetcard"><Matrix /></QRCode>;Every size. md is for a share sheet; lg for a screen held up to be
scanned.
Source
const Sizes = (args) => (
<div style={{ display: 'flex', alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
{(['sm', 'md', 'lg'] as const).map((size) => (
<QRCode key={size} {...args} size={size}>
<Matrix />
</QRCode>
))}
</div>
);A bare matrix. Use this when the code was generated without a reserved centre — a mark laid over live modules is a code that will not scan.
Source
const WithoutMark = () => <QRCode value="meetcard.io/ben@meetcard" logo={null}><Matrix /></QRCode>;Props
| Prop | Type | Default | Description |
|---|---|---|---|
valuerequired | string | — | The URL the code encodes, e.g. meetcard.io/ben@meetcard.
Not rendered. It is the code's accessible name, so someone who cannot
scan still learns where it goes. Surfaces that want the link readable —
ShareSheet does — put it next to the code as copyable text, which is
more useful than a caption nobody can select. |
children | ReactNode | — | Inline <svg> alternative to src, for a locally rendered code. |
logo | ReactNode | <Mark /> | The centre mark. Defaults to MeetCard's, since every code Deck draws is
a MeetCard code. Pass null for a bare matrix.
It sits directly on the code with nothing behind it, because generators
reserve the centre when a logo is configured. A code generated without
that reservation has modules under the mark and should be given null. |
size | 'sm' | 'md' | 'lg' | 'xl' | 'md' | — |
src | string | — | Rendered QR image, e.g. a generated PNG or SVG data URI. |
Also accepts everything from Omit, so id, data-* and event handlers pass straight through.