Skip to main content

Interactive Button Showcase

Elegant, animated buttons with hover effects that add a touch of sophistication to your interface.

Key Features

Smooth Transitions

Carefully timed animations create a professional, polished look on interaction.

Color Inversion

Background and text colors elegantly swap on hover for a striking visual effect.

Icon Animation

Arrow icons move and replace each other with a coordinated, staggered animation.

Button Variants

Explore different color schemes and styles while maintaining the same interactive animation pattern.

Classic Black

The original design with black background and white text that inverts on hover.

Royal Blue

A vibrant blue button that stands out as a primary call to action.

Royal Purple

Luxurious purple design perfect for premium or limited edition products.

Success Green

Perfect for positive actions like adding items or confirming choices.

Attention Red

Ideal for sales, discounts, or drawing attention to special offers.

Dark Charcoal

Subtle alternative to pure black, offering a softer appearance.

Sizes and Adaptations

Small

Small Size

Regular

Regular Size

Large

Large Size

Implementation Guide

A step-by-step guide to implementing this button using Tailwind CSS utility classes.

Tailwind CSS Implementation

Basic HTML Structure

<a href="#" class="group inline-flex items-center gap-3 bg-black text-white font-semibold rounded-full py-3 px-6 pl-5 whitespace-nowrap overflow-hidden text-ellipsis transition-colors duration-300 hover:bg-white hover:text-black border border-black">
  <span>Button Text</span>
  <span class="relative flex-shrink-0 w-[25px] h-[25px] bg-white text-black rounded-full grid place-items-center overflow-hidden group-hover:bg-black group-hover:text-white transition-colors duration-300">
    <svg viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2.5 h-2.5 transition-transform duration-300 ease-in-out group-hover:translate-x-[150%] group-hover:-translate-y-[150%]">
      <path d="M13.376 11.552l-.264-10.44-10.44-.24.024 2.28 6.96-.048L.2 12.56l1.488 1.488 9.432-9.432-.048 6.912 2.304.024z" fill="currentColor"></path>
    </svg>
    <svg viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2.5 h-2.5 absolute -translate-x-[150%] translate-y-[150%] transition-transform duration-300 ease-in-out delay-100 group-hover:translate-x-0 group-hover:translate-y-0">
      <path d="M13.376 11.552l-.264-10.44-10.44-.24.024 2.28 6.96-.048L.2 12.56l1.488 1.488 9.432-9.432-.048 6.912 2.304.024z" fill="currentColor"></path>
    </svg>
  </span>
</a>

Key Class Groups

  • Button Container

    Base styling for the button itself:

    inline-flex items-center gap-3 bg-black text-white font-semibold rounded-full py-3 px-6 pl-5 whitespace-nowrap overflow-hidden transition-colors duration-300

  • Hover States

    Color inversion on hover:

    hover:bg-white hover:text-black

  • Icon Wrapper

    Circular container for the icon:

    relative flex-shrink-0 w-[25px] h-[25px] bg-white text-black rounded-full grid place-items-center overflow-hidden group-hover:bg-black group-hover:text-white

  • Icon Animation

    First icon (exits on hover):

    transition-transform duration-300 ease-in-out group-hover:translate-x-[150%] group-hover:-translate-y-[150%]

    Second icon (enters on hover):

    absolute -translate-x-[150%] translate-y-[150%] transition-transform duration-300 ease-in-out delay-100 group-hover:translate-x-0 group-hover:translate-y-0

Implementation Steps

  1. 1

    Create the Basic Button

    Start with an anchor tag and add the necessary classes for styling the button container.

  2. 2

    Add Group Functionality

    Add the group class to the button to enable targeting child elements on hover.

  3. 3

    Add Button Text

    Add a span element with your button text within the anchor tag.

  4. 4

    Create Icon Wrapper

    Add a circular span that will contain both icon SVGs, with proper sizing and colors.

  5. 5

    Add Both SVG Icons

    Include two identical SVG icons, one visible by default and one hidden initially.

  6. 6

    Configure Icon Animations

    Position the icons and set up their hover animations using transform and transition classes.

Best Practices

  • Use the group and group-hover: modifiers for cleaner code.

  • Maintain consistent sizing of the button across different screen sizes with responsive utility classes.

  • Add focus: states for keyboard accessibility.

  • Keep transitions between 300-500ms for optimal user experience.

  • Use the delay-[ms] utility to create staggered animations.

Customization Options

Tailor the button to match your brand's aesthetic with these customization options.

Color Schemes

State Colors

Dark Mode Support