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
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
Preview Error
Could not load preview for: tabs-controlled
Error details
Error: ENOENT: no such file or directory, open '/app/apps/docs/examples/tabs-controlled.tsx'
Manage tab state externally for programmatic control and synchronization with other components.
Vertical Layout
Preview Error
Could not load preview for: tabs-vertical
Error details
Error: ENOENT: no such file or directory, open '/app/apps/docs/examples/tabs-vertical.tsx'
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
Prop | Type | Default | Description |
---|---|---|---|
defaultValue | string | - | The default active tab (uncontrolled mode) |
value | string | - | The active tab value (controlled mode) |
onValueChange | (value: string) => void | - | Callback when tab changes |
className | string | - | Additional CSS classes |
children | React.ReactNode | - | TabsList and TabsContents components |
TabsList
Prop | Type | Default | Description |
---|---|---|---|
activeClassName | string | - | Classes for the motion highlight element |
transition | Transition | { type: 'spring', stiffness: 200, damping: 25 } | Motion transition config |
className | string | - | Additional CSS classes |
children | React.ReactNode | - | TabsTrigger components |
TabsTrigger
Prop | Type | Default | Description |
---|---|---|---|
value | string | required | Unique identifier for the tab |
className | string | - | Additional CSS classes |
children | React.ReactNode | - | Tab label content |
TabsContents
Prop | Type | Default | Description |
---|---|---|---|
transition | Transition | { type: 'spring', stiffness: 300, damping: 30 } | Content slide transition |
className | string | - | Additional CSS classes |
children | React.ReactNode | - | TabsContent components |
TabsContent
Prop | Type | Default | Description |
---|---|---|---|
value | string | required | Matches TabsTrigger value |
className | string | - | Additional CSS classes |
children | React.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
Stars Scrolling Wheel
Animated stars scrolling wheel with number counter and completion effects. Perfect for React applications requiring achievement displays with Next.js integration and TypeScript support.
Announcement
Compound announcement badge component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring customizable themes, hover effects, and flexible content layout.