Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-floating-whatsapp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Floating Whatsapp
Simple react component for adding a floating WhatsApp button to your project.
Install
npm
npm i react-floating-whatsappYarn
yarn add react-floating-whatsappv5.0.0 - 2022-10-07
- BREAKING CHANGES: change default import to name import
- BREAKING CHANGES: rename
heightprop tochatboxHeight - BREAKING CHANGES: rename
stylesprop tostyle
Usage
import React from 'react'
import { FloatingWhatsApp } from 'react-floating-whatsapp'
export default function App() {
return (
<FloatingWhatsApp {/* Props */} />
)
}Props
| Prop | Type | Options | Description | Default |
|---|---|---|---|---|
phoneNumber |
String | Required | Phone number in intenational format | 1234567890 |
accountName |
String | Required | Account username | Account Name |
onClick |
Fuction | Optional | Callback function fires on click | - |
onSubmit |
Fuction | Optional | Callback function fires on submit with event and form input value passed | - |
onClose |
Fuction | Optional | Callback function fires on close | - |
onLoopDone |
Fuction | Optional | Callback function called when notification loop done | - |
avatar |
String | Optional | Change user avatar using static assets | UI Face |
statusMessage |
String | Optional | Text below the account username | Typically replies within 1 hour |
chatMessage |
String | Optional | Text inside the chat box. | Hello there! 🤝 \nHow can we help? |
placeholder |
String | Optional | Input placeholder. | Type a message.. |
darkMode |
Boolean | Optional | Dark style. | false |
allowClickAway |
Boolean | Optional | Closes the chat box when user clicks outside | false |
allowEsc |
Boolean | Optional | Closes the chat box when Escape key is pressed |
false |
className |
String | Optional | CSS className applied to the main wrapping Div |
floating-whatsapp |
buttonClassName |
String | Optional | CSS className applied to button | floating-whatsapp-button |
chatboxClassName |
String | Optional | CSS className applied to chat box | floating-whatsapp-chatbox |
style |
CSSProperties | Optional | Inline style applied to the main wrapping Div |
{} |
buttonStyle |
CSSProperties | Optional | Inline style applied to button | {} |
chatboxStyle |
CSSProperties | Optional | Inline style applied to chat box | {} |
chatboxHeight |
Number | Optional | Control chat box height | 320 |
notification |
Boolean | Optional | Allow notifications (Disabled after user open the chat box) | false |
notificationDelay |
Number | Optional | Time delay between notifications in seconds | 60 |
notificationSound |
Boolean | Optional | Allow notification sound | false |
notificationSoundSrc |
String | Optional | Notification sound custom src | - |
notificationLoop |
Number | Optional | Repeat notifications loop | 0 |
License
MIT © awran5