Plugin EcosystemSystem & OS
Contacts
Access the system address book and read contact details.
The Contacts plugin allows reading data from the user's system address book, which is essential for social and communication applications.
Installation
npm install @easycord/contactsAPI Reference
getContacts()
Retrieves a list of all contacts on the device.
import { Contacts } from '@easycord/contacts';
import { useState } from 'react';
export function ContactList() {
const [contacts, setContacts] = useState<any[]>([]);
const loadContacts = async () => {
try {
const data = await Contacts.getContacts();
setContacts(data);
} catch (err) {
console.error('Permission denied or failed to read contacts');
}
};
return (
<div>
<button onClick={loadContacts}>Sync Contacts</button>
<ul>
{contacts.map(c => <li key={c.id}>{c.displayName}</li>)}
</ul>
</div>
);
}