Skip to content

Floating WhatsApp button in React

A WhatsApp button pinned to the bottom of the screen that opens a welcome bubble with common topics and a pre-filled message, with no third-party widget.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

WhatsAppButton.tsx
import { useEffect, useRef, useState, type KeyboardEvent } from "react";

// Fictional number from the range ARCEP keeps for films and books: replace it with yours, digits only.
const PHONE = "33639981234";
const DEFAULT_MESSAGE = "Bonjour, j'ai une question au sujet de l'Atelier Terre & Feu.";

const stages = [
  "Initiation au tournage le samedi matin, trois heures, terre et cuisson comprises",
  "Week-end émaillage pour celles et ceux qui ont déjà tourné quelques pièces",
  "Atelier parent-enfant pendant les vacances scolaires, dès 7 ans",
];

Free component: copy it freely, including for commercial projects.

Buttons components in React
  • A row of buttons to share the page on Facebook, LinkedIn, WhatsApp or by email, with a copy-link button and no third-party script.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Toggle heart buttons that count favourites, remember them between visits and announce them to screen readers.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A button that adds an event to Google Calendar, Outlook or any calendar through an .ics file, with no third-party service.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A button that copies an IBAN, a reference, an address or a promo code and confirms "Copied", on screen and to screen readers.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A bar pinned to the bottom of mobile screens with Call and Directions buttons and a live open-now status, built for trades and local shops.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Circular icon buttons with an accessible tooltip on hover and focus.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component