Skip to main content

Standards W3C vCard Examples

These snippets use shared context constants and common property keys to build contact objects.

VCard Contexts And Properties

import { VCardContexts, VCardPropertyType } from '@twin.org/standards-w3c-vcard';

const card = {
'@context': VCardContexts.Context,
type: VCardPropertyType.Individual,
[VCardPropertyType.FormattedName]: 'Alex Example',
[VCardPropertyType.Email]: 'mailto:[email protected]',
[VCardPropertyType.Phone]: 'tel:+44-20-1234-5678'
};

console.log(card.type); // Individual
console.log(card[VCardPropertyType.FormattedName]); // Alex Example