Tabs

Tabs organize content into multiple sections and allow users to navigate between them.

Import

import { Tabs } from "@thenamespace/uikit";

Usage

View your project overview and recent activity.

import { Tabs } from "@thenamespace/uikit";

export function Basic() {
  return (
    <Tabs className="w-full max-w-md">

Anatomy

Import the Tabs component and access all parts using dot notation.

import { Tabs } from "@thenamespace/uikit";

export default () => (
  <Tabs>
    <Tabs.ListContainer>
      <Tabs.List aria-label="Options">
        <Tabs.Tab>
          <Tabs.Separator /> {/* Optional */}
          <Tabs.Indicator />
        </Tabs.Tab>
      </Tabs.List>
    </Tabs.ListContainer>
    <Tabs.Panel />
  </Tabs>
);

Vertical

Account Settings

Manage your account information and preferences.

import { Tabs } from "@thenamespace/uikit";

export function Vertical() {
  return (
    <Tabs className="w-full max-w-lg" orientation="vertical">

Overflow

When the tab list exceeds the available space, Tabs.ListContainer automatically renders scroll chevrons and fading edges so users can navigate the hidden tabs. This works the same way for both horizontal and vertical orientations.

Overview panel content.

import { Tabs } from "@thenamespace/uikit";

const items = [
  { id: "overview", label: "Overview" },
  { id: "analytics", label: "Analytics" },

Disabled Tab

This tab is active and can be selected.

import { Tabs } from "@thenamespace/uikit";

export function Disabled() {
  return (
    <Tabs className="w-full max-w-md">

With Separator

Add <Tabs.Separator /> inside each <Tabs.Tab> (except the first) to display separator lines between tabs.

View your project overview and recent activity.

import { Tabs } from "@thenamespace/uikit";

export function WithSeparator() {
  return (
    <Tabs className="w-full max-w-md">

Custom Styles

import { Tabs } from "@thenamespace/uikit";

export function CustomStyles() {
  return (
    <Tabs className="w-full max-w-lg text-center">

Secondary Variant

View your project overview and recent activity.

import { Tabs } from "@thenamespace/uikit";

export function Secondary() {
  return (
    <Tabs className="w-full max-w-md" variant="secondary">

Secondary Variant Vertical

Account Settings

Manage your account information and preferences.

import { Tabs } from "@thenamespace/uikit";

export function SecondaryVertical() {
  return (
    <Tabs className="w-full max-w-lg" orientation="vertical" variant="secondary">

Custom Render Function

"use client";

import {Tabs} from "@thenamespace/uikit";
import Link from "next/link";

Styling

Passing Tailwind CSS classes

import { Tabs } from '@thenamespace/uikit';

function CustomTabs() {
return (
<Tabs className="w-full max-w-lg text-center">

CSS Classes

The Tabs component uses these CSS classes:

Base Classes

  • .tabs - Base tabs container
  • .tabs__list-container - Tab list container wrapper
  • .tabs__list - Tab list container
  • .tabs__tab - Individual tab button
  • .tabs__separator - Separator between tabs
  • .tabs__panel - Tab panel content
  • .tabs__indicator - Tab indicator

Orientation Attributes

  • .tabs[data-orientation="horizontal"] - Horizontal tab layout (default)
  • .tabs[data-orientation="vertical"] - Vertical tab layout

Variant Classes

  • .tabs--secondary - Secondary variant with underline indicator

Interactive States

The component supports both CSS pseudo-classes and data attributes:

  • Selected: [aria-selected="true"]
  • Hover: :hover or [data-hovered="true"]
  • Focus: :focus-visible or [data-focus-visible="true"]
  • Disabled: [aria-disabled="true"]

API Reference

Tabs Props

PropTypeDefaultDescription
variant"primary" | "secondary""primary"Visual style variant. Primary uses a filled indicator, secondary uses an underline indicator
orientation"horizontal" | "vertical""horizontal"Tab layout orientation
selectedKeystring-Controlled selected tab key
defaultSelectedKeystring-Default selected tab key
onSelectionChange(key: Key) => void-Selection change handler
classNamestring-Additional CSS classes
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, TabsRenderProps>-Overrides the default DOM element with a custom render function.

Tabs.List Props

PropTypeDefaultDescription
aria-labelstring-Accessibility label for tab list
classNamestring-Additional CSS classes
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, TabListRenderProps>-Overrides the default DOM element with a custom render function.

Tabs.Tab Props

PropTypeDefaultDescription
idstring-Unique tab identifier
isDisabledbooleanfalseWhether tab is disabled
classNamestring-Additional CSS classes
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, TabRenderProps>-Overrides the default DOM element with a custom render function.

Tabs.Separator Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Tabs.Panel Props

PropTypeDefaultDescription
idstring-Panel identifier matching tab id
classNamestring-Additional CSS classes
renderDOMRenderFunction<keyof React.JSX.IntrinsicElements, TabPanelRenderProps>-Overrides the default DOM element with a custom render function.