Components

Interactive Hover Button

A React pill button with an interactive hover effect: a small dot grows to fill the button while the label slides away and an arrow with a new label slides in. Built on the DuskUI Button with Tailwind CSS, it animates only transform and opacity, and keyboard focus triggers the same state as hover.

  • Built on DuskUI Button
  • Transform & opacity only
  • Keyboard focus state
  • Width-stable
  • prefers-reduced-motion

Installation

$ npx shadcn@latest add https://duskui.com/r/interactive-hover-button.json

Builds on the DuskUI Button; the CLI installs it automatically. Installing by hand? Add components/ui/button.tsx from the Button page first.

Usage

cta.tsx
import { InteractiveHoverButton } from "@/components/dusk/interactive-hover-button/interactive-hover-button"

export function Cta() {
  return <InteractiveHoverButton size="lg">Get started</InteractiveHoverButton>
}

Examples

Color, icon & hover label

color sets the dot and fill, fillForeground the text on top of it. icon replaces the arrow and hoverLabel shows different text on hover.

Loading

loading comes from the base Button: the content crossfades to a spinner without changing the width, and the button stays focusable.

API Reference

Also accepts every DuskUI Button prop (size, loading, loadingText) except variant and asChild.

PropTypeDefaultDescription
colorstringvar(--color-primary)Any CSS color for the dot and the fill.
fillForegroundstringvar(--color-primary-foreground)Text color on top of the fill.
hoverLabelReactNodechildrenLabel shown in the hover state.
iconReactNode<ArrowRight />Icon that slides in with the hover label.
classNamestring—Merged with tailwind-merge, so overrides win.

Accessibility

  • Renders a native <button>; keyboard focus (focus-visible) shows the same filled state as hover, plus the standard focus ring.
  • The hover label is aria-hidden, so screen readers announce the main label once.
  • Both labels share one grid cell, so the button is always as wide as the wider label and never shifts layout.
  • With prefers-reduced-motion nothing slides: the labels crossfade and the fill appears instantly.
  • Only transform and opacity animate, so the effect stays smooth and never triggers layout.