Join our Discord community
Interactive

Tabs

Animated tabs with smooth transitions and motion highlight. Perfect for React applications requiring organized content sections with Next.js integration and TypeScript support.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/tabs.json
npx shadcn@latest add https://www.shadcn.io/registry/tabs.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/tabs.json
bunx shadcn@latest add https://www.shadcn.io/registry/tabs.json

Features

  • Smooth animations with configurable spring transitions using Motion
  • Motion highlight indicator that follows the active tab selection
  • Controlled and uncontrolled modes for flexible state management
  • TypeScript support with complete generic type definitions
  • Blur effect transitions on content switching for visual polish
  • Flexible layouts supporting horizontal and vertical orientations

Examples

Controlled Tabs

Loading component...

Manage tab state externally for programmatic control and synchronization with other components.

Vertical Layout

Loading component...

Create sidebar navigation patterns with vertically aligned tabs and content areas.

Use Cases

This free open source React component works well for:

  • Settings panels - Organize configuration options into logical groups built with Next.js
  • Profile pages - Separate user information, preferences, and activity using TypeScript and Tailwind CSS
  • Documentation - Structure content with navigation between different sections
  • Form wizards - Create multi-step forms with shadcn/ui integration
  • Dashboard layouts - Switch between different data views and reports

API Reference

Tabs

PropTypeDefaultDescription
defaultValuestring-The default active tab (uncontrolled mode)
valuestring-The active tab value (controlled mode)
onValueChange(value: string) => void-Callback when tab changes
classNamestring-Additional CSS classes
childrenReact.ReactNode-TabsList and TabsContents components

TabsList

PropTypeDefaultDescription
activeClassNamestring-Classes for the motion highlight element
transitionTransition{ type: 'spring', stiffness: 200, damping: 25 }Motion transition config
classNamestring-Additional CSS classes
childrenReact.ReactNode-TabsTrigger components

TabsTrigger

PropTypeDefaultDescription
valuestringrequiredUnique identifier for the tab
classNamestring-Additional CSS classes
childrenReact.ReactNode-Tab label content

TabsContents

PropTypeDefaultDescription
transitionTransition{ type: 'spring', stiffness: 300, damping: 30 }Content slide transition
classNamestring-Additional CSS classes
childrenReact.ReactNode-TabsContent components

TabsContent

PropTypeDefaultDescription
valuestringrequiredMatches TabsTrigger value
classNamestring-Additional CSS classes
childrenReact.ReactNode-Tab panel content

Implementation Notes

  • The component uses layout effects for accurate position calculations
  • Motion highlight automatically tracks the active tab's position
  • Content transitions use horizontal sliding with configurable spring physics
  • Blur effects enhance the perception of content switching
  • The first tab is automatically selected if no default is provided
  • Compatible with shadcn/ui design system and form components