Skip to content

Sweep-fill buttons in WordPress

Three button styles whose colour sweeps across the background on hover and keyboard focus: left to right, bottom to top or from the centre.

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

effet-bouton-remplissage-balayage.php
<?php
/**
 * Plugin Name: Forge, Boutons à remplissage balayé
 * Description: Trois styles de boutons dont la couleur balaie le fond au survol et au focus clavier : de gauche à droite, du bas vers le haut ou depuis le centre. Ajoute la composition « Boutons à remplissage balayé » à 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-effet-bouton-remplissage-balayage
 *
pattern.html
<!-- wp:group {"tagName": "section", "className": "efrb-effet-bouton-remplissage-balayage", "layout": {"type": "default"}} -->
<section class="wp-block-group efrb-effet-bouton-remplissage-balayage"><!-- wp:heading {"level": 2, "className": "efrb-title", "anchor": "efrb-titre"} -->
<h2 class="wp-block-heading efrb-title" id="efrb-titre">Une table ce soir au Comptoir des Halles ?</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"className": "efrb-text"} -->
<p class="efrb-text">Service de 19 h à 22 h 30, du mardi au samedi. Les groupes de plus de huit personnes réservent par téléphone.</p>
<!-- /wp:paragraph -->
<!-- wp:group {"className": "efrb-row", "layout": {"type": "default"}} -->
<div class="wp-block-group efrb-row"><!-- wp:html -->
<a class="efrb-btn efrb-btn--solid" href="#efrb-reserver">Réserver en ligne</a>
<!-- /wp:html -->
<!-- wp:html -->
style.css
:root {
  --efrb-effet-bouton-remplissage-balayage-card: #ffffff;
  --efrb-effet-bouton-remplissage-balayage-text: #1f1a17;
  --efrb-effet-bouton-remplissage-balayage-muted: #574c45;
  --efrb-effet-bouton-remplissage-balayage-solid: #7f1d1d;
  --efrb-effet-bouton-remplissage-balayage-solid-text: #ffffff;
  --efrb-effet-bouton-remplissage-balayage-solid-fill: #5c1414;
  --efrb-effet-bouton-remplissage-balayage-line: #7f1d1d;
  --efrb-effet-bouton-remplissage-balayage-tint: #fde2e2;
  --demo-effet-bouton-remplissage-balayage-bg: #f4eeea;
  --demo-effet-bouton-remplissage-balayage-text: #1f1a17;
}

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

Visual effects components in WordPress
  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component