Sectioned panels for switching between related views.
npx shadcn@latest add @iconiq/tabs"use client";
import { useState } from "react";
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@/components/ui/tabs";
export function TabsPreview() {
const [value, setValue] = useState("overview");
return (
<Tabs
className="w-full max-w-2xl"
animateContent
value={value}
onValueChange={setValue}
>
<TabsList>
<TabsTrigger value="overview">
Overview
</TabsTrigger>
<TabsTrigger value="activity">
Activity
</TabsTrigger>
<TabsTrigger value="files">
Files
</TabsTrigger>
</TabsList>
<TabsContent key="overview" value="overview">
<div className="space-y-3 p-4">
<p className="font-medium text-[15px] text-foreground tracking-[-0.02em]">
Product workspace
</p>
<p className="text-[14px] text-secondary leading-6">
Keep the main summary visible while switching between planning, delivery, and support details without leaving the current surface.
</p>
</div>
</TabsContent>
<TabsContent key="activity" value="activity">
<div className="space-y-3 p-4">
<p className="font-medium text-[15px] text-foreground tracking-[-0.02em]">
Recent handoff
</p>
<p className="text-[14px] text-secondary leading-6">
Review the last design review, implementation notes, and timeline updates in a compact panel that still feels grounded.
</p>
</div>
</TabsContent>
<TabsContent key="files" value="files">
<div className="space-y-3 p-4">
<p className="font-medium text-[15px] text-foreground tracking-[-0.02em]">
Shared assets
</p>
<p className="text-[14px] text-secondary leading-6">
Attach decks, mockups, and implementation references while preserving a clear transition between each content block.
</p>
</div>
</TabsContent>
</Tabs>
);
}childrenCompose TabsList, TabsTrigger, and TabsContent inside the root.
Type ReactNode
defaultValueInitial active tab for uncontrolled usage. Falls back to the first TabsContent value when omitted or invalid.
Type string
valueControlled active tab value. Invalid values fall back to the first TabsContent value in development with a console warning.
Type string
onValueChangeCalled when a trigger activates a different tab through click or keyboard interaction.
Type (value: string) => void
variantSwitches between the segmented pill rail and the underline indicator treatment.
Type "pill" | "underline"·Default "pill"
animateContentApplies a short fade-and-rise transition to the active panel body. Respects reduced-motion preferences.
Type boolean·Default false
orientationRadix orientation forwarded to the list and content layout. Vertical roots render as a flex row with the list beside the panel.
Type "horizontal" | "vertical"·Default "horizontal"
activationModeRadix activation mode. Manual keeps focus and selection separate until Enter or Space.
Type "automatic" | "manual"·Default "automatic"
dirRadix text direction for keyboard navigation order.
Type "ltr" | "rtl"
classNameMerged onto the Radix tabs root wrapper.
Type string
childrenUsually a row of TabsTrigger elements.
Type ReactNode
fullWidthStretches the list to the container width instead of fitting the trigger row.
Type boolean·Default false
loopRadix loop behavior for keyboard navigation across the first and last triggers.
Type boolean·Default true
classNameMerged onto the trigger rail element.
Type string
valueUnique tab identifier used for active state and content matching.
Type string
childrenLabel content rendered inside the trigger button.
Type ReactNode
iconOptional leading icon rendered before the label with consistent sizing.
Type ReactNode
badgeOptional trailing badge such as a count or status chip.
Type ReactNode
classNameMerged onto the trigger button for local spacing, typography, or state overrides.
Type string
disabledPrevents the trigger from receiving focus or changing the active tab.
Type boolean
valueMatches the corresponding TabsTrigger value.
Type string
childrenPanel body shown when the content value is active.
Type ReactNode
classNameMerged onto the rendered content panel element.
Type string
forceMountKeeps the panel mounted while inactive. Useful for preserving form state or SSR-friendly markup.
Type boolean
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @radix-ui/react-tabs, motion.
Contact
Additionally, if you find any bug or issue, feel free to raise an issue.