npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@coogichrisla/contact-elements

v0.1.0

Published

A collection of reusable contact UI elements for React applications

Downloads

8

Readme

Contact Elements

A collection of reusable React components for building contact management interfaces.

Installation

```bash npm install contact-elements

or

yarn add contact-elements ```

Components

ContactCard

A card component to display contact information.

```jsx import { ContactCard } from 'contact-elements';

function MyComponent() { // Option 1: Provide contact data directly const contact = { id: '1', name: 'John Doe', email: '[email protected]', phone: '555-123-4567', company: 'Acme Inc.', position: 'CEO' };

return ( <ContactCard userId="user123" contact={contact} onEdit={(contact) => console.log('Edit', contact)} onDelete={(id) => console.log('Delete', id)} onClick={(contact) => console.log('Clicked', contact)} /> );

// Option 2: Let the component fetch data return ( <ContactCard userId="user123" contactId="contact456" onEdit={(contact) => console.log('Edit', contact)} onDelete={(id) => console.log('Delete', id)} onClick={(contact) => console.log('Clicked', contact)} /> ); } ```

ContactForm

A form component for creating or editing contacts.

```jsx import { ContactForm } from 'contact-elements';

function MyComponent() { // Option 1: Handle form submission manually return ( <ContactForm userId="user123" initialData={{ name: 'John', email: '[email protected]' }} onSubmit={(data) => console.log('Submit', data)} onCancel={() => console.log('Cancel')} isLoading={false} /> );

// Option 2: Edit an existing contact with API return ( <ContactForm userId="user123" contactId="contact456" onSuccess={(contact) => console.log('Contact updated', contact)} onCancel={() => console.log('Cancel')} /> ); } ```

ContactList

A component to display a list of contacts.

```jsx import { ContactList } from 'contact-elements';

function MyComponent() { // Option 1: Provide contacts data directly const contacts = [ { id: '1', name: 'John Doe', email: '[email protected]' }, { id: '2', name: 'Jane Smith', email: '[email protected]' } ];

return ( <ContactList userId="user123" contacts={contacts} onContactClick={(contact) => console.log('Click', contact)} onContactEdit={(contact) => console.log('Edit', contact)} onContactDelete={(id) => console.log('Delete', id)} isLoading={false} emptyMessage="No contacts found" /> );

// Option 2: Let the component fetch data return ( <ContactList userId="user123" onContactClick={(contact) => console.log('Click', contact)} onContactEdit={(contact) => console.log('Edit', contact)} onContactDelete={(contact) => console.log('Delete', contact)} /> ); } ```

ContactDetails

A component to display detailed information about a contact.

```jsx import { ContactDetails } from 'contact-elements';

function MyComponent() { // Option 1: Provide contact data directly const contact = { id: '1', name: 'John Doe', email: '[email protected]', phone: '555-123-4567', company: 'Acme Inc.', position: 'CEO', notes: 'Met at conference in June.' };

return ( <ContactDetails userId="user123" contactId="1" contact={contact} onEdit={(contact) => console.log('Edit', contact)} onDelete={(id) => console.log('Delete', id)} onBack={() => console.log('Back')} /> );

// Option 2: Let the component fetch data return ( <ContactDetails userId="user123" contactId="1" onEdit={(contact) => console.log('Edit', contact)} onDelete={(id) => console.log('Delete', id)} onBack={() => console.log('Back')} /> ); } ```

ContactSearch

A search component for filtering contacts.

```jsx import { ContactSearch } from 'contact-elements';

function MyComponent() { return ( <ContactSearch onSearch={(query) => console.log('Search', query)} placeholder="Find contacts..." initialValue="" /> ); } ```

API

The package includes a built-in API client for contact operations:

```jsx import { ContactsApi, contactsApi } from 'contact-elements';

// Use the default instance async function fetchContacts() { const contacts = await contactsApi.getContacts('user123'); console.log(contacts); }

// Or create a custom instance with options const api = new ContactsApi({ baseUrl: 'https://api.example.com' }); async function createContact() { const newContact = await api.createContact('user123', { name: 'John Doe', email: '[email protected]' }); console.log(newContact); } ```

Types

The package exports TypeScript types for all components:

```typescript import type { Contact, ContactCardProps, ContactFormProps, ContactListProps, ContactDetailsProps, ContactSearchProps, ApiOptions } from 'contact-elements'; ```

Development

This package is built with Vite and TypeScript. See BUILDING.md for more information on building and developing the package.

License

MIT