Animated Tabs

Use Animated Tabs to switch between related views in the same part of a page. It provides keyboard navigation, disabled items, controlled state, and a shared hover indicator for pointer input.

Preview

Reduce motion:Off
Tune:Off
Inspect

Installation

Basic usage

TypeScript
account-tabs.tsx

Examples

Controlled state

Use value and onValueChange when the selected view is also represented in page state or the URL.

Disabled tabs

Disable a tab only when its destination is unavailable. Keep the label visible so people understand what will become available.

Usage

API

PropertyTypeDefaultDescription
tabsAnimatedTabItem[]requiredTabs displayed in the horizontal tab list.
valuestring—Controlled active tab value.
defaultValuestring—Initially active tab for uncontrolled usage.
onValueChange(value: string) => void—Called 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.
classNamestring—Additional classes for the root container.
listClassNamestring—Additional classes for the tab list.

Accessibility

Animated Tabs uses Base UI tab semantics and roving keyboard focus. The hover indicator is limited to pointer input, so keyboard navigation does not imply a hover state.

Styling

Override the root, list, active item, and indicator classes to match the surrounding navigation. Reduced-motion preferences simplify the indicator transition.

Contact

Found a bug or need help using this component? Open an issue on GitHub.

License & Usage

Sona UI is available under the MIT license. You may use, modify, and distribute this component in personal and commercial projects.

Was this page helpful?

Your response helps us improve component docs.