Interactive Hover Button
A button component with an interactive hover effect that features an expanding dot and sliding text animation with an arrow icon. The button creates a smooth transition effect when hovered, revealing an arrow while the text slides in from the right.Installation
Usage
Examples
Basic Usage
With Custom Styling
With Click Handler
Props
The content to display inside the button.
Additional CSS classes to apply to the button.
All standard HTML button attributes are supported (onclick, disabled, type, etc.).
Component Details
Animation Behavior
The Interactive Hover Button creates a sophisticated hover effect through multiple animated elements:- Expanding Dot: A small circular dot that scales up dramatically on hover (scale factor of 100.8x)
- Sliding Text: The original button text slides to the right and fades out
- Revealing Content: A hidden duplicate of the text slides in from the right with an arrow icon
CSS Classes
The component uses these default classes:- Base:
group bg-background relative w-auto cursor-pointer overflow-hidden rounded-full border p-2 px-6 text-center font-semibold - Dot:
bg-primary h-2 w-2 rounded-full transition-all duration-300 group-hover:scale-[100.8] - Text (visible):
inline-block transition-all duration-300 group-hover:translate-x-12 group-hover:opacity-0 - Text (hidden):
text-primary-foreground absolute top-0 z-10 flex h-full w-full translate-x-12 items-center justify-center gap-2 opacity-0 transition-all duration-300 group-hover:-translate-x-5 group-hover:opacity-100
Dependencies
@lucide/svelte- For the arrow icon- Tailwind CSS - For styling and transitions
Accessibility
The component maintains full button functionality and supports:- Keyboard navigation (Tab, Enter, Space)
- Screen readers (semantic button element)
- Focus states
- All standard button attributes (disabled, aria-*, etc.)