@dxkit-org/react-floating-whatsapp
v1.0.9
Published
π Fully customizable React WhatsApp floating button component with TypeScript support, dark mode, notifications, and seamless WhatsApp integration for modern web applications
Downloads
278
Maintainers
Keywords
Readme
React Floating WhatsApp Component π¬
The most customizable and feature-rich React WhatsApp floating button component - Add professional WhatsApp integration to your website with TypeScript support, dark mode, notifications, and seamless user experience.
π Why Choose React Floating WhatsApp?
Perfect for e-commerce, customer support, lead generation, and business websites that need instant customer communication. Used by thousands of developers worldwide!
π Quick Installation & Setup
NPM Installation
npm install @dxkit-org/react-floating-whatsappYarn Installation
yarn add @dxkit-org/react-floating-whatsappPNPM Installation
pnpm add @dxkit-org/react-floating-whatsappπ» Basic Usage Example
Get started in seconds with this simple implementation:
import React from 'react'
import { FloatingWhatsApp } from '@dxkit-org/react-floating-whatsapp'
export default function App() {
return (
<FloatingWhatsApp
phoneNumber='1234567890'
accountName='Your Business'
avatar='/path/to/avatar.jpg'
statusMessage='Typically replies within 1 hour'
chatMessage='Hello! π How can we help you today?'
darkMode={false}
allowClickAway={true}
allowEsc={true}
notification={true}
notificationSound={true}
/>
)
}π¨ Advanced Usage with Custom Styling
import React from 'react'
import { FloatingWhatsApp } from '@dxkit-org/react-floating-whatsapp'
export default function App() {
const handleSubmit = (event, message) => {
console.log('Message sent:', message)
// Add your custom logic here
}
return (
<FloatingWhatsApp
phoneNumber='1234567890'
accountName='Customer Support'
onSubmit={handleSubmit}
className='custom-whatsapp-widget'
buttonStyle={{ backgroundColor: '#25D366' }}
chatboxStyle={{ borderRadius: '20px' }}
darkMode={true}
notification={true}
notificationDelay={30}
/>
)
}π Complete API Reference & Props
Customize every aspect of your WhatsApp widget with these comprehensive 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 |
| openChatOnClick | Boolean | Optional | open the chat box if clicked on whatsApp icon | true |
| allowDefaultSubmit | Boolean | Optional | Allow default submit behavior of redirecting to whatsApp on submit | true |
| 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 |
π― Live Demo & Playground
Try it live on CodeSandbox and see all features in action!
β¨ Key Features & Benefits
- π Zero Configuration - Works out of the box with minimal setup
- πΌ Full TypeScript Support - Complete type safety and IntelliSense
- π¨ Highly Customizable - Custom styling with CSS classes and inline styles
- π Dark/Light Mode - Built-in theme switching capability
- π Smart Notifications - Configurable notification system with sound support
- π± Mobile Responsive - Perfect on all devices and screen sizes
- β¨οΈ Accessibility Ready - Full keyboard navigation and ESC key support
- π±οΈ Click Outside to Close - Intuitive user interaction patterns
- π― Event Callbacks - Hook into click, submit, close, and notification events
- π Direct WhatsApp Integration - Seamless connection to WhatsApp Web/App
- β‘ Lightweight - Minimal bundle size impact on your application
- π§ Framework Agnostic - Works with Next.js, Gatsby, CRA, and more
π’ Perfect For
- E-commerce Websites - Instant customer support and sales assistance
- Business Websites - Lead generation and customer inquiries
- Service Providers - Quick booking and consultation requests
- SaaS Applications - User support and onboarding assistance
- Portfolio Sites - Direct client communication
- Landing Pages - Convert visitors into leads
π Browser Support
- β Chrome (Latest)
- β Firefox (Latest)
- β Safari (Latest)
- β Edge (Latest)
- β Mobile browsers (iOS Safari, Chrome Mobile)
π¦ What's Included
- React component with TypeScript definitions
- Default avatars and sound files
- CSS modules for styling
- Comprehensive documentation
- Live examples and demos
π€ Contributing & Support
We welcome contributions! Please see our Contributing Guide for details.
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π§ Email Support: [email protected]
π NPM Stats
- Weekly Downloads: Growing rapidly
- Bundle Size: Lightweight and optimized
- Dependencies: Minimal peer dependencies (React 18+)
- TypeScript: Full type coverage
π Related Packages
Looking for more React components? Check out our other packages:
@dxkit-org/react-components- Complete UI component library- More coming soon!
β Show Your Support
If this package helped you, please consider:
- β Starring the GitHub repository
- π¦ Sharing on Twitter with #ReactFloatingWhatsApp
- π Writing a review or blog post
- π€ Contributing to the project
π Credits & Acknowledgments
This project is forked from awran5/react-floating-whatsapp with significant enhancements including:
- TypeScript improvements
- Additional customization options
- Enhanced notification system
- Better accessibility
- Improved documentation
- Bug fixes and stability improvements
Special thanks to all contributors and the React community!
π License
MIT Β© dxkit-org
Made with β€οΈ by the dxkit-org team
Website β’ Twitter β’ GitHub
Don't forget to β star this repository if it helped you!
