Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

vCard Button

ProNew

Saves a person's details as a contact file built in the browser, with an optional QR code that scans straight into a phone's contacts.

Installation

pnpm dlx shadcn@latest add @viewport/vcard-button

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
contact*VCardContact—
childrenReact.ReactNode

The button's label.

"Save contact"
qrboolean

Add a second button that shows the card as a QR code, to scan straight into a phone's contacts.

false
fileNamestring

The file's name, without the extension. Defaults to the person's name.

—
variant"primary" | "outline""outline"
size"sm" | "md" | "lg""md"
classNamestring—

Accessibility

  • Confirms in the button and announces that the file was downloaded.
  • The QR button is named after the person and opens a labelled code with instructions.
  • Produces vCard 3.0, which phones and mail clients import.
  • Respects prefers-reduced-motion.