Tabs

Tabs are the ultimate content organizers! Now featuring multiple variants, icons, badges, and professional styling that transforms cluttered interfaces into elegant, navigable experiences.

Preview
Code

Default Tabs

Welcome Home

This is your home dashboard with all the latest updates and notifications.

Underline Tabs

Overview content with clean underline styling.

Pills Tabs

Your personalized feed content.

Button Tabs

Dashboard widgets and metrics.

With Icons & Badges

Your messages and conversations.

Size Variants

Small tab content

Large tab content with more spacing

Installation

First, make sure you have the required dependencies:

npx @rajdevxd/aura-ui add tabs
yarn @rajdevxd/aura-ui add tabs
pnpm dlx @rajdevxd/aura-ui add tabs
bunx --bun @rajdevxd/aura-ui add tabs

Usage

Here's how to create enhanced tabbed interfaces with all the new features:

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { IconHome, IconUser, IconSettings } from "@tabler/icons-react"

const EnhancedTabs = () => {
  return (
    <Tabs defaultValue="home">
      {/* Pills variant with icons and badges */}
      <TabsList variant="pills">
        <TabsTrigger value="home" variant="pills" icon={<IconHome className="h-4 w-4" />}>
          Home
        </TabsTrigger>
        <TabsTrigger value="profile" variant="pills" icon={<IconUser className="h-4 w-4" />}>
          Profile
        </TabsTrigger>
        <TabsTrigger value="settings" variant="pills" icon={<IconSettings className="h-4 w-4" />} badge={<span className="bg-red-500 text-white text-xs rounded-full px-1.5 py-0.5">3</span>}>
          Settings
        </TabsTrigger>
      </TabsList>

      <TabsContent value="home">
        <div className="p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg">
          <h4 className="font-medium mb-2">Welcome Home</h4>
          <p className="text-sm text-muted-foreground">Your personalized dashboard and recent activity.</p>
        </div>
      </TabsContent>

      <TabsContent value="profile">
        <div className="p-4 bg-green-50 dark:bg-green-900/20 rounded-lg">
          <h4 className="font-medium mb-2">User Profile</h4>
          <p className="text-sm text-muted-foreground">Manage your profile settings and personal information.</p>
        </div>
      </TabsContent>

      <TabsContent value="settings">
        <div className="p-4 bg-purple-50 dark:bg-purple-900/20 rounded-lg">
          <h4 className="font-medium mb-2">Settings</h4>
          <p className="text-sm text-muted-foreground">Configure your preferences and account settings.</p>
        </div>
      </TabsContent>
    </Tabs>
  )
}

Components

Tabs

The root container that manages tab state.

TabsList

Container for tab triggers, handles layout.

TabsTrigger

Individual tab buttons that users click.

TabsContent

Content panels that show/hide based on active tab.

Props

Tabs

PropTypeRequiredDescription
defaultValuestringNoInitial active tab value
valuestringNoControlled active tab value
onValueChange(value: string) => voidNoCallback when tab changes

TabsList

PropTypeRequiredDescription
variant"default" | "underline" | "pills" | "buttons"NoVisual style variant
size"sm" | "default" | "lg"NoSize variant for all tabs

TabsTrigger

PropTypeRequiredDescription
valuestringYesUnique identifier for the tab
variant"default" | "underline" | "pills" | "buttons"NoVisual style variant
size"sm" | "default" | "lg"NoSize variant
iconReact.ReactNodeNoIcon to display before text
badgeReact.ReactNodeNoBadge/count to display after text
disabledbooleanNoWhether the tab is disabled

TabsContent

PropTypeRequiredDescription
valuestringYesContent identifier matching TabsTrigger

Features

  • 🎨 Multiple Variants: Default, Underline, Pills, and Buttons styles
  • 📏 Size Options: Small, Default, and Large sizes
  • 🎯 Icons Support: Add icons to any tab trigger
  • 🏷️ Badge System: Display counts, notifications, or custom badges
  • ♿ Full Accessibility: Keyboard navigation and ARIA support
  • 🎭 Smooth Animations: Beautiful transitions between tab content
  • 🔧 Disabled States: Support for disabled tabs
  • 🎪 Visual Feedback: Hover effects and active states
  • 📱 Responsive Design: Works perfectly on all screen sizes
  • 🎨 Theme Integration: Adapts to your design system

Common Issues

  1. "Tabs not switching!" - Make sure TabsTrigger and TabsContent have matching values
  2. "Content not showing!" - Check that TabsContent values match TabsTrigger values
  3. "Styling issues!" - Ensure proper CSS for tab layouts

Contributing

Tabs organize complex interfaces! Help us improve their accessibility and animations.

Tabs - because not everything belongs on the same page! 📑