This is a lightweight, reusable Floating WhatsApp Button component designed to increase customer engagement on websites. It consists of a prominent floating green button that, when clicked, opens a clean popup inviting users to chat via WhatsApp.
Component Architecture
1. Floating Action Button (FAB)
<div class="wa-front-btn" id="wa-front-btn">
<i class="bi bi-whatsapp"></i>
</div>
The main trigger button, usually positioned fixed at the bottom right corner. It uses Bootstrap Icons for the WhatsApp logo and includes an ID for JavaScript interaction.
2. Popup Window
<div class="wa-front-popup" id="wa-front-popup"> ... </div>
The popup contains two main sections:
- Header: Title ("Questions? Doubts?"), subtitle, and close button.
- Content Area: Informational message and a clickable contact card that redirects to WhatsApp.
3. WhatsApp Redirect Link
<a href="https://web.whatsapp.com/send?phone=" target="_blank" ...>
This link opens WhatsApp Web (or the mobile app on smartphones). The phone= parameter must be populated with the full international number (example: 237000000).
Technologies Used
- Bootstrap 5.3.3 – For responsive layout and utilities
- Bootstrap Icons – WhatsApp icon and close button
- Custom CSS (style.css) – Controls positioning, animations, colors, and hover effects
- Custom JavaScript (script.js) – Handles open/close behavior of the popup
How It Works
When the user clicks the floating button, JavaScript displays the popup. The popup can be closed via the "X" button. The component is designed to be non-intrusive yet highly visible, following common UX patterns for customer support widgets.
Key Technical Features
- Fully responsive design
- Fixed positioning (stays on screen while scrolling)
- Clean separation between structure (HTML), appearance (CSS), and behavior (JS)
- Uses semantic and accessible markup with Bootstrap best practices
- Easy to customize colors, texts, and avatar
Recommended Improvements
- Complete the phone number in the WhatsApp link
- Add click-outside-to-close functionality
- Implement mobile deep linking (
whatsapp://send) - Add loading state or success message after click
- Use data attributes for easier configuration
This floating WhatsApp component is production-ready, lightweight, and highly effective for lead generation and instant customer support.