Skip to content

Sweep-fill buttons

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

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

A solid fill unfolds under the button text as soon as it is hovered or reached with the keyboard: a solid button darkening from left to right, an outline button filling from bottom to top, a discreet link colouring from the centre. The effect is a pseudo-element whose transform alone is animated, with no script, and an --efrb-fill variable for each button’s colour. Fill tints are chosen so the text never changes colour and keeps AA contrast at every moment, in light and dark mode; the focus outline stays visible on top of the fill. They are real 48 px tall links, ready to book, call or view a menu. With prefers-reduced-motion the fill appears at once, without sweeping. Example: the action bar of a Lyon restaurant.

Code

Loading the code…

The code of this component in

Archive contents

effet-bouton-remplissage-balayage-html-tailwind.zip3 files · 4 Ko

  • index.html4 Ko
  • README.md3 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • 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