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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-contact-buttons

v1.4.3

Published

Buttons to copy, send a mail, whatsapp, telegram, skype, sms and call a phone number

Downloads

39

Readme

react-contact-buttons

Contact buttons to copy to clipboard, open in Whatsapp, Telegram, Skype, call and send sms to a number and send a mail with Gmail or Outlook.

Installation and Usage

Install it via yarn or npm

yarn add react-contact-buttons

or

npm install react-contact-buttons

Then import the buttons, add component, props and children to use them:

import React from "react";
import { 
    CopyToClipboard, 
    OpenWhatsApp, 
    OpenTelegram, 
    OpenSkypeSoftware, 
    OpenGmail, 
    OpenOutlook, 
    CallTo, 
    SmsTo 
} from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <ComponentName props > children </ComponentName>
    </div>
);

Props

You can use and customize these buttons using the below props, out of which "tel", "to", "tUser" and "sUser" are the only required prop, the rest are optional.

| Name | Type | Default | Description | | :-: |:-: |:-: |--- | | tel | String | none | The telephone number to be used (Only CopyToClipboard, OpenWhatsApp, CallTo and SmsTo). | | msg | String | none | The message to be added automatically and sent (Only OpenWhatsApp and SmsTo). | | tUser | String | none | The user phone number or username to be used (Only OpenTelegram). | | sUser | String | none | The user to be used (Only OpenSkypeSoftware). | | action | String | chat | Choose action with these options: "chat", "call" or "videoCall" (Only OpenSkypeSoftware). | | to | String | none | The email to be used (Only OpenGmail and OpenOutlook). | | cc | String | none | The email to be used like CC (Only OpenGmail and OpenOutlook). | | bcc | String | none | The email to be used like CCO (Only OpenGmail and OpenOutlook). | | subject | String | none | The subject to be used in the mail (Only OpenGmail and OpenOutlook). | | body | String | none | The body to be used in the mail (Only OpenGmail and OpenOutlook). | | linkToUse | String | live | Choose mail link with these options: "live" or "office365" (Only OpenOutlook). | | onCopy | Boolean | false | Used to recive true or false if it was possible or not make the copy (Only CopyToClipboard). | | idButton | String | a text | The button id (All). | | titleText | String | null | The button title (All). | | ariaLabel | String | null | The button aria-label (All). | | classes | String | null | The class or classes to be applied to the button (All). | | styles | style object | null | The styles to be applied to the button (All). | | children | ReactNode | a text | Use this to add some custom content inside the button (All). |

Examples

CopyToClipboard

import React from "react";
import { CopyToClipboard } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <CopyToClipboard 
            tel="+123456789" 
            onCopy={(e) => console.log(e)} 
        />
    </div>
);

Basic button (If no styles and children are applied) it will look like this: basicCopyButton and you will see true or false in console.

OpenWhatsApp

import React from "react";
import { OpenWhatsApp } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <OpenWhatsApp 
            tel="+123456789" 
            msg="Some Message"
            styles={{ 
                backgroundColor: 'transparent', 
                border: 'none', 
                borderRadius: '12px', 
                margin: '0px', 
                padding: '0px' 
            }}
        >
            <img alt="Chat on WhatsApp" src="WhatsAppButtonGreenLarge.svg" />
        </OpenWhatsApp>
    </div>
);

Button with some styles and an image as children, looks like this: chatOnWhatsapp Download image here

OpenTelegram

import React from "react";
import { OpenTelegram } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <OpenTelegram 
            tUser="+12345678" or "username" 
            styles={{ 
                backgroundColor: 'transparent', 
                border: 'none', 
                borderRadius: '50%', 
                margin: '0px', 
                padding: '0px' 
            }}
        >
            <img alt="Chat on Telegram" src="Logo.svg" width="50px" height="50px"/>
        </OpenTelegram>
    </div>
);

Button with some styles and an image as children, looks like this: chatOnTelegram Download image here

OpenSkypeSoftware

import React from "react";
import { OpenSkypeSoftware } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <OpenSkypeSoftware 
            sUser="Skype name" 
            action="chat" 
            styles={{ backgroundColor: 'transparent', border: 'none' }}
        >
            <img alt="Skype Software" src="chatbutton_32px.png" />
        </OpenSkypeSoftware>
    </div>
);

Button with some styles and an image as children, looks like this: chatbutton_32px Download image here, please follow the brand-guidelines for the correct use of the name, icons and images.

OpenGmail

import React from "react";
import { OpenGmail } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <OpenGmail 
            to="[email protected]" 
            cc="[email protected]" 
            bcc="[email protected]" 
            subject="Some subject" 
            body="Some body"
            classes={"btn btn-primary"}
        >
            Use Gmail
        </OpenGmail>
    </div>
);

Button with Bootstrap class and a text as children, looks like this: bootstrapClassButton (you must have bootstrap installed in your project).

OpenOutlook

import React from "react";
import { OpenOutlook } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <OpenOutlook 
            to="[email protected]" 
            cc="[email protected]" 
            bcc="[email protected]" 
            subject="Some subject" 
            body="Some body" 
            classes="contact"
        >
            Use Outlook
        </OpenOutlook>
    </div>
);

Button if you add some css styles and a text as children, looks like this: cssButton

CallTo

import React from "react";
import { CallTo } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <CallTo tel="+123456789" titleText="Press to Call" />
    </div>
);

Button if you add titleText, the classic tooltip will appear, looks like this: buttonTitle

SmsTo

import React from "react";
import { SmsTo } from 'react-contact-buttons'

const YourComponent = () => (
    <div>
        <SmsTo 
            tel="+123456789" 
            msg="Some Message"
            idButton="SmsBut"
            ariaLabel="sms" 
        />
    </div>
);

The idea is to build something pressable so that the user can interact with the page and make the contact.