RoadieRoadie
  • Home
  • Foundations
  • Tokens
  • Components
  • Charts
  • Widgets
  • Appearance
HomeFoundationsComponents
Appearance

Components

  • Navigation

    • Breadcrumb
    • Navigator
    • Steps
    • Tabs
  • Layout

    • Pane
    • ScrollArea
    • Separator
  • Actions

    • Button
    • IconButton
    • Toggle
    • Toggle group
  • Forms

    • Forms overview
    • Autocomplete
    • Checkbox
    • Combobox
    • Field
    • Fieldset
    • Input
    • Label
    • Number field
    • OTP field
    • Radio group
    • Select
    • Slider
    • Switch
    • Textarea
  • Overlays

    • Dialog
    • Drawer
    • Menu
    • Popover
    • Toast
    • Tooltip
  • Collections

    • Accordion
    • Card
    • Carousel
    • Collapsible
    • DataTable
    • List
    • Marquee
    • Table
  • Status

    • Badge
    • Callout
    • Countdown
    • Empty state
    • Meter
    • Progress
    • Skeleton
    • Sparkline
    • StatTile
  • Media & brand

    • Avatar
    • Icon Tile
    • Image
    • Logo
    • QR code
    • SpotIllustration
  • Text

    • CalendarTile
    • Code
    • DateTime
    • Duration
    • Highlight
    • Mark
    • Prose

QR code

A QR code for scanning tickets at the gate.

Import

import { QRCode } from '@oztix/roadie-components/qr-code'

Examples

Default

The default code is branded: square modules with the Oztix mark on a dark 5×5-module tile in the centre.

<div className='w-48'>
  <QRCode value='A7K2MKWX' aria-label='Ticket QR code' />
</div>

Plain

branded={false} renders a standard code with no mark and nothing cleared.

<div className='w-48'>
  <QRCode value='A7K2MKWX' branded={false} aria-label='Ticket QR code' />
</div>

Custom mark

children swaps the mark on the tile, the same way Navigator.Brand takes your own logo. The mark is drawn white in a 3.4-module square, so pass an <svg> with a viewBox, or an icon at size='100%', filled with currentColor. The tile and its size don't change, so a custom mark scans exactly like the Oztix one.

<div className='w-48'>
  <QRCode value='A7K2MKWX' aria-label='Ticket QR code'>
    <StarIcon weight='fill' size='100%' />
  </QRCode>
</div>

Composition

On the ticket, the code sits at the top at full width, with the ticket type under it and the ticket holder below a perforation. If a scan fails, gate staff look the ticket up by the holder's name.

<div className='grid max-w-sm rounded-2xl bg-subtle p-4 intent-brand'>
  <Card variant='ticket' emphasis='raised' intent='neutral'>
    <Card.Content className='grid justify-items-center gap-4 p-6 pb-5'>
      <QRCode
        value='A7K2MKWX'
        aria-label='Ticket QR code for General admission'
      />
      <p className='text-display-ui-4 text-strong'>General admission</p>
    </Card.Content>
    <Card.Footer className='grid gap-4'>
      <div className='flex items-center gap-3'>
        <IconTile emphasis='subtler' size='lg'>
          <UserCircleIcon weight='bold' />
        </IconTile>
        <div className='grid min-w-0 flex-1'>
          <p className='font-semibold text-strong'>Jordan Nguyen</p>
          <p className='truncate text-sm text-subtle'>jordan.nguyen@example.com</p>
        </div>
        <IconButton aria-label='Edit ticket holder' emphasis='subtle'>
          <PencilSimpleIcon weight='bold' />
        </IconButton>
      </div>
      <div className='grid grid-cols-[1fr_auto] gap-2'>
        <Button emphasis='subtle' className='w-full'>
          <WalletIcon weight='bold' />
          Add to Wallet
        </Button>
        <Button emphasis='subtle'>
          <ExportIcon weight='bold' />
          Share
        </Button>
      </div>
    </Card.Footer>
  </Card>
</div>

Guidelines

The code's colours, module shape and tile size are fixed on purpose. Every styled option scored worse in scan testing, and the tile is sized in modules so a longer value never grows it into something a scanner mistakes for a finder pattern.

Show it large

Do

Show the code as large as the layout allows, at least 160px wide on phones. Module size on screen decides how well it scans through blur and distance.

General admission

Don’t

Don't shrink it into a list row.

Keep it on white

<div className='rounded-xl bg-raised p-4'>
<QRCode value={ticket.hash} />
</div>

Do

The code carries its own white quiet zone, so it reads on any surface. Frame it on a light tile.

<div className='emphasis-strong intent-brand p-1'>
<QRCode value={ticket.hash} className='rounded-full' />
</div>

Don’t

Don't crop the quiet zone, and don't sit it on a dark or brand surface without room around the white.

Don't restyle the modules

<QRCode value={ticket.hash} />

Do

Use the code as it renders. It's dark on white in light mode, dark mode and inside any intent.

<QRCode value={ticket.hash} className='[&_path]:fill-brand-11' />

Don’t

Don't recolour, round or space the modules. Rounded modules and mid blues both cost scans, and warm colours fail red-LED scanners.

Keep a custom mark simple and light

Do

Use a bold, single-colour mark that inherits the white. The tile is already counted as lost, so the mark never affects scanning.

<QRCode value={ticket.hash}>
<img src='/logo.png' className='size-24' />
</QRCode>

Don’t

Don't pass a photo, a full-colour logo or anything sized in pixels. It won't fit the tile's square or read against the dark tile.

Accessibility

  • The code is one image with role="img" and the default name "QR code". Pass a specific aria-label, such as "Ticket QR code for General admission".
  • The mark is hidden from assistive technology.
  • A screen reader can't read the code, so keep the event, ticket type and holder's name as visible text on the ticket.

API reference

QRCode

valuestring
Required

The text to encode, such as a ticket hash. Encoded as given at error correction level H.

brandedboolean

Adds a mark on a 5×5-module tile in the centre. `false` renders a plain code.

Defaults to true.

childrenReactNode

The mark on the branded tile, drawn white in a 3.4-module square. Pass an `<svg>` with a `viewBox`, or an icon at `size='100%'`, filled with `currentColor`.

Defaults to <OztixMark />.

Previous page← LogoNext pageSpotIllustration →