Skip to content

Round icon buttons in WordPress

Circular icon buttons with an accessible tooltip on hover and focus.

Here is an excerpt of this component's code in WordPress. 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 WordPress

boutons-icones-ronds.php
<?php
/**
 * Plugin Name: Forge, Boutons icônes ronds
 * Description: Des boutons circulaires à icône avec une infobulle accessible au survol et au focus. Ajoute la composition « Boutons icônes ronds » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-boutons-icones-ronds
 *
pattern.html
<!-- wp:group {"className": "demo-boutons-icones-ronds__row", "layout": {"type": "default"}} -->
<div class="wp-block-group demo-boutons-icones-ronds__row"><!-- wp:html -->
<button type="button" class="icon-button" aria-label="Ajouter aux favoris" data-tooltip="Ajouter aux favoris">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.3 4.6 13a4.7 4.7 0 0 1 6.7-6.7l.7.8.7-.8A4.7 4.7 0 0 1 19.4 13Z"/></svg>
        </button>
<!-- /wp:html -->
<!-- wp:html -->
<button type="button" class="icon-button icon-button--accent" aria-label="Partager" data-tooltip="Partager">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8.5 13.5l7-4M8.5 10.5l7 4M18 6.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM8 12a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Zm10 5.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"/></svg>
        </button>
<!-- /wp:html -->
<!-- wp:html -->
style.css
:root {
  --icon-bg: #ffffff;
  --icon-border: #d6d3d1;
  --icon-color: #292524;
  --icon-hover: #f5f5f4;
  --icon-accent: #4338ca;
  --icon-danger: #b91c1c;
  --tooltip-bg: #1c1917;
  --tooltip-text: #fafaf9;
  --icon-ring: #4338ca;
  --demo-boutons-icones-ronds-bg: #f5f5f4;
  --demo-boutons-icones-ronds-text: #1c1917;

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

Buttons components in WordPress
  • 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 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.

    • 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