vCard Button
ProNewSaves 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
| Prop | Type | Default |
|---|---|---|
| contact* | VCardContact | — |
| children | React.ReactNodeThe button's label. | "Save contact" |
| qr | booleanAdd a second button that shows the card as a QR code, to scan straight into a phone's contacts. | false |
| fileName | stringThe file's name, without the extension. Defaults to the person's name. | — |
| variant | "primary" | "outline" | "outline" |
| size | "sm" | "md" | "lg" | "md" |
| className | string | — |
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.