Search

Search documentation

Tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Installation

pnpm dlx shadcn@latest add @evolphin/tabs

Usage

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
<Tabs defaultValue="account" className="w-[400px]">
  <TabsList>
    <TabsTrigger value="account">Account</TabsTrigger>
    <TabsTrigger value="password">Password</TabsTrigger>
  </TabsList>
  <TabsContent value="account">Make changes to your account here.</TabsContent>
  <TabsContent value="password">Change your password here.</TabsContent>
</Tabs>

Type Definitions

interface TabsProps {
  /** The value of the selected tab */
  value?: string;
TabsProps.value?: string | undefined

The value of the selected tab

/** The default value of the selected tab when uncontrolled */ ?: string; /** Event handler called when the value changes */ ?: (: string) => void; /** The orientation of the tabs */ ?: "horizontal" | "vertical"; /** The direction of navigation */ ?: "ltr" | "rtl"; /** Whether the tabs should be activated automatically on focus */ ?: "automatic" | "manual"; }

Examples

Default

Account

Make changes to your account here. Click save when you're done.

API Reference

Tabs

PropTypeDefaultDescription
defaultValuestring-The value of the tab to select by default.
valuestring-The controlled value of the tab to select.
onValueChange(value: string) => void-Event handler called when the value changes.
orientation`"horizontal" \"vertical"`"horizontal"
dir`"ltr" \"rtl"`"ltr"
activationMode`"automatic" \"manual"`"automatic"
classNamestring-Additional CSS classes

TabsList

PropTypeDefaultDescription
loopbooleantrueWhether keyboard navigation should loop around.
classNamestring-Additional CSS classes

TabsTrigger

PropTypeDefaultDescription
valuestring-A unique value for the tab.
disabledbooleanfalseWhether the trigger is disabled.
classNamestring-Additional CSS classes

TabsContent

PropTypeDefaultDescription
valuestring-A unique value for the tab.
forceMountboolean-Used to force mounting when more control is needed.
classNamestring-Additional CSS classes

On this page