# QR Code Card (Components)

URL: https://qrdx.dev/docs/components/qr-code-card
Source: https://github.com/qrdxinc/qrdx/blob/main/apps/docs/content/docs/components/qr-code-card.mdx

A card with a QR code in a "Scan me" frame, a title, a description and room for actions, for shadcn/ui projects.

`QrCodeCard` puts a QR code in a card with a call-to-action frame, a heading, a line of text and a footer for buttons. Use it where a code is the point of the card: a table tent, a check-in screen, an event poster preview, a "download our app" tile.

## Installation [#installation]

```bash
npx shadcn@latest add @qrdx/qr-code-card
```

Or by URL, which works with older versions of the CLI too:

```bash
npx shadcn@latest add https://qrdx.dev/r/qr-code-card.json
```

## Usage [#usage]

```tsx title="components/example.tsx"
import { QrCodeCard } from "@/components/qr-code-card";
```

```tsx title="components/example.tsx"
<QrCodeCard
  value="https://example.com/menu"
  title="Our menu"
  description="Scan to see today's specials."
/>
```

Anything you pass as children renders in the card footer, such as a copy button or a [download menu](https://qrdx.dev/docs/components/qr-code-download).

## Examples [#examples]

### Frames [#frames]

`frame` puts the call to action under the code (`"bottom"`), above it (`"top"`) or leaves the frame out (`"none"`). `cta` changes the label, and `frameClassName` restyles the frame, for example with your brand color.

The frame uses your theme's `foreground` and `background` colors by default, so it stays legible in light and dark mode. The code itself keeps a light background, which every scanner reads.

### Styling the code [#styling-the-code]

`qr` takes any qrdx style option: `fgColor`, `bgColor`, gradients, `bodyPattern`, corner patterns, `logo` and `frame`.

```tsx title="components/brand-card.tsx"
import { QrCodeCard } from "@/components/qr-code-card";

export function BrandCard() {
  return (
    <QrCodeCard
      value="https://example.com"
      title="example.com"
      qr={{
        fgColor: "#155DFC",
        bodyPattern: "rounded",
        cornerEyePattern: "extra-rounded",
      }}
    />
  );
}
```

## Accessibility and rendering [#accessibility-and-rendering]

- The code sits in a `role="img"` element whose `aria-label` is `label`, or `QR code: <value>` without one. Set `label` when the value is not a public link.
- `title` renders as the card's heading and `description` under it; both take any React node.
- The component is a Client Component. A Server Component page can import it and pass server data as props, and the code is rendered on the server.

## API reference [#api-reference]

### $Fumadocs

| Prop              | Type          | Description                                                                            |
| ----------------- | ------------- | -------------------------------------------------------------------------------------- |
| `value`           | `string`      | Text or URL to encode.                                                                 |
| `title?`          | `ReactNode`   | Heading under the code.                                                                |
| `description?`    | `ReactNode`   | Supporting text under the heading.                                                     |
| `cta?`            | `string`      | Call to action printed on the frame. Pass `""` for a plain frame. Default: `"Scan me"` |
| `frame?`          | `union`       | Where the frame label sits, or `"none"` for no frame. Default: `"bottom"`              |
| `frameClassName?` | `string`      | Extra classes for the frame, e.g. `"bg-primary text-primary-foreground"`.              |
| `size?`           | `number`      | Width and height of the code in pixels. Default: `168`                                 |
| `qr?`             | `QrCodeStyle` | qrdx style options for the code.                                                       |
| `label?`          | `string`      | Accessible name. Defaults to "QR code: <value>".                                       |
| `children?`       | `ReactNode`   | Footer content, such as buttons.                                                       |

Any other prop, such as `className`, is passed to the [Card](https://ui.shadcn.com/docs/components/card).

## Related [#related]

- [QR Code Download](https://qrdx.dev/docs/components/qr-code-download): A download menu to drop into the card's footer.
- [QR Code](https://qrdx.dev/docs/components/qr-code): The code on its own, with download buttons.
- [Frames, scan score and print files](https://qrdx.dev/docs/features/frames): The library's own frames, drawn into the code's image.
