Hover Expand

An accordion-style gallery where panels expand on hover or focus and collapse the rest, with a rotating label in collapsed state.

Open in v0

Last updated: August 13, 2026

Installation

npx smoothui-cli add hover-expand

Features

  • Flex-basis/flex-grow driven expansion animated with Motion
  • Horizontal or vertical orientation, with labels rotating vertical when collapsed in horizontal mode
  • Each panel is a real, focusable <button> — focus expands it
  • Tap-to-expand on touch/non-hover devices instead of relying on hover
  • Controlled activeIndex/onActiveIndexChange support

Accessibility

ARIA Attributes

AttributeElementPurpose
role="group"Panel containerGroups the panels as a single widget
aria-labelPanel containerNames the widget "Expandable image panels"
aria-labelEach panel buttonNames the panel by its title
aria-pressedEach panel buttonIndicates whether the panel is currently expanded

Screen Reader

  • Each panel is a native <button>, so its expanded state is exposed via aria-pressed and its label via aria-label.
  • Panel titles and descriptions remain in the DOM at all times; only their visual rotation/opacity changes.

Keyboard

KeyDescription
TabMoves focus between panels in document order
ArrowRight / ArrowDownMoves focus (and expansion) to the next panel
ArrowLeft / ArrowUpMoves focus (and expansion) to the previous panel

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, the flex-grow change is instant with no spring easing, and labels do not rotate or animate their opacity.

Props

Created by

Powered by

motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.