# QR Code Button — React Native component for Expo

> A pill that morphs into a card with a real, scannable QR code.

A "Show QR Code" pill that swells under your finger and morphs, on a smooth ease, into a white card holding a real, scannable QR code — Copy and close below it. The code is encoded inside the component (byte mode, error correction M, every version up to 40) and drawn as one crisp SVG path, so there's no QR library to install.

- Docs: https://expokit.in/docs/components/qr-code-button
- Tier: Pro (ExpoKit Pro plan)
- Also called: QR code generator, QR code share button, scan to pay button
- Category: Buttons
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: Default, Ticket, Copy

## Installation

This component is part of ExpoKit Pro. With a Pro plan, log the CLI in once and add it like any other item:

```bash
npx @expokit/cli@latest login
```

Plans: https://expokit.in/pricing

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` | — | What the code encodes: a URL, a payment link, a ticket id. |
| `label` | `string` | `labels.showQrCode` | Text on the pill. |
| `copyLabel` | `string` | `labels.copy` | Copy button text. |
| `copiedLabel` | `string` | `labels.copied` | Shown after Copy is pressed. |
| `closeLabel` | `string` | `labels.close` | Screen-reader name of the card's close button. Set it app-wide with KitProvider's labels. |
| `onCopy` | `(value: string) => void` | — | Wire your clipboard here (expo-clipboard). |
| `open` | `boolean` | — | Controlled state. |
| `defaultOpen` | `boolean` | `false` | Uncontrolled initial state. |
| `onOpenChange` | `(open: boolean) => void` | — | Opened or closed. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Pill height 36 / 44 / 52. |
| `codeSize` | `number` | `168` | Side of the code in points; the card wraps it. |
| `color` | `string` | `white (dark) / primary (light)` | Pill colour. The card stays white so the code scans. |
| `accessibilityLabel` | `string` | `label` | Screen reader label for the pill. |
| `style` | `StyleProp<ViewStyle>` | — | Root style. |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Motion**: Press swells the pill; it glides into the card while its label fades out and the code fades and scales in. Close glides it back.
- **Layout**: Reserves the open card's size up front, so nothing around it moves and every control stays inside its own bounds (taps work on Android).
- **Code**: Encoded in the component: UTF-8 bytes, error correction M, smallest version that fits, mask chosen by the spec's penalty rules. Always dark on white so it scans in dark mode too.
- **Copy**: Calls onCopy with the value and flips to a tick and "Copied" for 1.5 s.
- **Haptics**: A light impact on open, a success tap on Copy, a tick on close.
- **Reduced motion**: Opens and closes with a short fade.
- **Screen readers**: A button with an expanded state; the code reads as "QR code for …".

## FAQ

### How do I make a QR code generator in React Native?

Use ExpoKit's QR Code Button, a Pro component: with ExpoKit Pro, the ExpoKit CLI copies a ready-made QR code generator into your Expo or React Native app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does QR Code Button work in Expo Go?

Yes. QR Code Button runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add QR Code Button to my Expo app?

With ExpoKit Pro, add it with the ExpoKit CLI: it copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change. The install command is on this page for Pro members.

### Is QR Code Button free?

QR Code Button is part of ExpoKit Pro. With a Pro plan, log the CLI in once and it installs the full source into your app.

### Can I change how QR Code Button looks?

Yes. It takes its colours, radius and light / dark mode from useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.

## More

- Live preview, variants and code: https://expokit.in/docs/components/qr-code-button
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
