@qr-city/vue

Vue 3 component for qr-city: a 3D city whose rooftops form a scannable QR code.
707
Install
npm install @qr-city/vue
Latest Version:0.3.1
Vue:3
License:MIT
Last Updated:Oct 18, 2026
Links: GitHub  ·  npm
Maintainer: danioliva

qr-city

@qr-city/vue

Vue 3 component for qr-city: a 3D city whose rooftops form a scannable QR code. Vue ≥ 3.3, three as a peerDependency.

npm i @qr-city/vue three
<script setup lang="ts">
import { ref } from 'vue';
import { QrCity } from '@qr-city/vue';

const city = ref<InstanceType<typeof QrCity> | null>(null);
</script>

<template>
  <QrCity ref="city" data="https://your-site.dev" city-style="nevada" style="width: 480px" @reveal="console.log('city ready')" />
  <button @click="city?.reveal()">Reveal QR</button>
</template>

Props and events

The same options as createQrCity: data, city-style, intro, pause-at-threshold, view, error-correction, quality, interactive, animate, max-pixel-ratio, zoomable, max-zoom, wheel-zoom, fallback, background, label and door-label. city-style is the city's style ('moderna' | 'costera' | 'ciberpunk' | 'nevada' or a QrCityStyle object), because style is the container's CSS style.

Event Payload
reveal —
intro-stage 'door' | 'entering' | 'threshold' | 'flying' | 'done'
view-change 'city' | 'qr'
zoom-change number
fallback Error: no WebGL, a flat scannable QR is shown
error Error

class and style fall through to the container, which by default is a square as wide as its parent.

Behaviour

  • Server (SSR, Nuxt…): renders an empty <div> and starts WebGL in onMounted. In Nuxt, use <ClientOnly> to avoid the empty placeholder.
  • Prop changes: applied in place; the city only rebuilds when data, city-style, error-correction or quality change.
  • intro is fixed at creation: if it changes, the component restarts.
  • Absent booleans are not false: they are not passed to the core, which applies its own defaults.
  • Without WebGL a flat, scannable QR is shown and fallback is emitted (fallback="none" to get an error instead). Other errors (invalid data…) reach the error event; the component never throws on mount.
  • Printable QR: toQrSvg() / toQrPng() on the ref, or qrToSvg(data) / qrToPng(data) (exported).
  • Component ref: controller, reveal(), setView(), toggleView(), setZoom(), zoomBy(), resetZoom(), openDoor(), continueIntro(), skipIntro(), toPNG(), play(), pause(), view, zoom, stage.

License

MIT. "QR Code" is a registered trademark of DENSO WAVE INCORPORATED.

Related Packages

@tresjs/core

Declarative ThreeJS using Vue Components

1,355,627 3,774
vue-qrcode-component

Create QR codes with a simple Vue component

262,895 123
vue-qrcode-component-v3

Create QR codes with a simple Vue component

42,152 0
vue-qr-code

vue-qr-code

11,388 2
@tresjs/cientos

Collection of useful helpers and fully functional, ready-made abstractions for T...

993,536 3,774

Version History

Version Released Vue License
0.3.1 >=3.3 MIT
0.3.0 >=3.3 MIT
0.2.0 >=3.3 MIT
0.1.0 >=3.3 MIT
Pre-releases (1)
Version Released License
0.0.0-stage