Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-floating-whatsapp

awran515.2kMIT5.0.8TypeScript support: included

Simple React Component for adding a floating WhatsApp button to your project.

react, whatsapp, floating whatsapp button, whatsapp button, react component, react typescript

readme

React Floating Whatsapp

Simple react component for adding a floating WhatsApp button to your project.

NPM npm bundle size GitHub

screenshot

Install

npm

npm i react-floating-whatsapp

Yarn

yarn add react-floating-whatsapp

v5.0.0 - 2022-10-07

  • BREAKING CHANGES: change default import to name import
  • BREAKING CHANGES: rename height prop to chatboxHeight
  • BREAKING CHANGES: rename styles prop to style
  • BREAKING CHANGES: notificationDelay now in seconds instead of millisecond

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 Function Optional Callback function fires on click -
onSubmit Function Optional Callback function fires on submit with event and form input value passed -
onClose Function Optional Callback function fires on close -
onLoopDone Function Optional Callback function called when notification loop done -
onNotification Function Optional Callback function fired when notification runs -
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..
messageDelay Number Optional Time delay after which the chatMessage is displayed (in seconds). 2
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
style CSSProperties Optional Inline style applied to the main wrapping Div {}
buttonStyle CSSProperties Optional Inline style applied to button {}
chatboxHeight Number Optional Control chat box height 320
chatboxClassName String Optional CSS className applied to chat box floating-whatsapp-chatbox
chatboxStyle CSSProperties Optional Inline style applied to chat box {}
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
notificationStyle CSSProperties Optional Inline style applied to notification -
notificationClassName String Optional CSS className applied to notification indicator floating-whatsapp-notification

Edit react-floating-whatsapp

License

MIT © awran5

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v5.0.8

v5.0.8 - 2022-12-31

Merged

  • Allow customization of messageDelay #19
  • Revert "Fix Storybook startup" #20
  • Fix Storybook startup #18

Commits

  • build: upgrade dependencies c738d6d
  • build: add @rollup/plugin-terser 4bf43c7
  • refactor: add @rollup/plugin-terser 9210063

v5.0.7 - 2022-11-27

Commits

v5.0.6 - 2022-10-20

Commits

  • animation bug on safari with ios 16 2a06980
  • fix: button animation bug #14 651f8b9
  • fix: button animation bug #14 e644ff1

v5.0.5 - 2022-10-19

Commits

  • fix: whatsapp button animation not work properly on safari with ios 16 6c9e000

v5.0.4 - 2022-10-07

v5.0.3 - 2022-10-07

v5.0.2 - 2022-10-07

Commits

v5.0.1 - 2022-10-07

Merged

  • feat: adds 'send' aria-label to button #12
  • Adding Default Message to README.md #10
  • Adding Default Message Option to the Whatsapp Button #9

Commits

  • build: update dependencies 59ddd9e
  • build: remove example folder 36c5110
  • feat: add new props and improvements b5bcc21

v5.0.0 - 2022-10-07

Commits

  • build: update dependencies d46f6ce
  • build: update dependencies 41c4aff
  • build: remove example folder ba14d8d

4.0.5 - 2021-09-25

v4.0.5 - 2021-09-25

Commits

v4.0.4 - 2021-09-25

Commits

v4.0.3 - 2021-09-25

v4.0.2 - 2021-09-25

v4.0.1 - 2021-09-25

Commits

v4.0.0 - 2021-09-25

Commits

v3.0.0 - 2021-08-20

Commits

  • feat(update & new props): update dependencies & added new props 984b22f
  • perf(test prop): test prop 543ff9f
  • feat(new props): add: new props 9843949

v2.1.0 - 2021-08-19

Merged

  • feat: custom placeholder #6

Commits

  • fix: message as default 3332756
  • styles: suggestion for shadow in the box 66f8cff
  • styles: adjust input chat to the bottom 8fe55e9

v2.0.1 - 2021-07-06

Commits

v2.0.0 - 2021-07-06

Commits

  • refactor: update dependencie 299689c

v1.5.0 - 2021-07-01

Commits

v1.2.0 - 2021-05-23

Merged

  • Version Packages #2

Commits

v1.1.0 - 2021-05-23

Merged

  • Version Packages #1

Commits