Animated Tabs

Open in v0
~8.6 kB

Last updated: September 20, 2026

Animated React tabs component with underline, pill, and segment variants, smooth sliding indicators, and icon support.

Installation

npx smoothui-cli add animated-tabs

Features

Three treatments for the same tab list: a sliding underline, a filled pill, and a segmented control. Controlled or uncontrolled, with icons, keyboard nav, and reduced-motion support.

Variants

Underline

A sliding underline tracks the active tab.

Pill

The active tab is a filled pill that slides between items.

Segment

A segmented control: the indicator fills the active cell.

Accessibility

Keyboard Interactions

KeyDescription
Arrow RightMoves focus and selection to the next tab (wraps to first)
Arrow LeftMoves focus and selection to the previous tab (wraps to last)
HomeMoves focus and selection to the first tab
EndMoves focus and selection to the last tab

ARIA Attributes

AttributeElementPurpose
role="tablist"ContainerIdentifies the tab group as a tablist
aria-label="Tabs"ContainerProvides an accessible name for the tablist
role="tab"Tab buttonIdentifies each button as a tab
aria-selectedTab buttonIndicates which tab is currently active
tabindexTab buttonUses roving tabindex: active tab is 0, inactive tabs are -1

Screen Reader

  • Only the active tab is in the tab order; arrow keys navigate between tabs
  • Each tab announces its selected state via aria-selected

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, the sliding indicator animation between tabs is disabled instantly.

Props

Created by

Improved by

Eduardo Calvo's avatar

Powered by

motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.