// // Copyright 2026 DXOS.org // // @import-as-namespace import { QrCode as QrCodePrimitive } from '@ark-ui/react/qr-code'; import React, { forwardRef } from 'react'; import { mx } from '@dxos/ui-theme'; import { type ThemedClassName } from '@dxos/ui-types'; import { recipes } from '../../recipes.ts'; import * as Icon from '../Icon/Icon.tsx'; export type QrCodeErrorCorrection = 'L' | 'M' | 'Q' | 'H'; export type QrCodeProps = ThemedClassName< Omit > & { /** What the code encodes. */ value: string; /** How much of the code may be lost and still read; higher costs modules. `M` by default. */ errorCorrection?: QrCodeErrorCorrection; /** An icon over the centre, which the error correction must cover (use `Q` or `H`). */ icon?: string; /** Names the code (`aria-label`); otherwise reference a visible name with `aria-labelledby`. */ label?: string; }; /** * Ark's QR code: a square that fills its host's width, its modules drawn in the current text colour on a transparent * ground so it reads on any surface. The root is the element (`role=img`), so a label lands on it. */ export const QrCode = forwardRef( ({ classNames, value, errorCorrection = 'M', icon, label, ...props }, forwardedRef) => ( {icon && ( )} ), ); QrCode.displayName = 'QrCode';