Animated Tabs Component

AnimatedTabs is an accessible horizontal tab selector built on Base UI, with controlled and uncontrolled state, keyboard navigation, disabled items, and a pointer-only shared hover indicator.

Features

  • Accessible foundation: Base UI provides roving focus and horizontal keyboard navigation.
  • Controlled or uncontrolled: Use value or defaultValue depending on your state model.
  • Pointer-aware motion: The shared hover indicator does not animate keyboard-initiated navigation.
  • Customizable: Override active, indicator, root, and list classes.
  • Reduced motion: Uses the shared Sona reduced-motion transition.

Playground

Controls
Controls

Installation

Usage

Props

PropertyTypeDefaultDescription
tabsAnimatedTabItem[]requiredTabs displayed in the horizontal tab list.
valuestringControlled active tab value.
defaultValuestringInitially active tab for uncontrolled usage.
onValueChange(value: string) => voidCalled when the active tab changes.
ariaLabelstring"Tabs"Accessible label for the tab list.
indicatorClassNamestring"bg-accent"Background class for the shared active indicator.
activeTabClassNamestring"bg-muted"Background class for the active tab.
classNamestringAdditional classes for the root container.
listClassNamestringAdditional classes for the tab list.