Tabs
Switches between related content panels in place, no page navigation. Use the default segmented look on dashboards, keep to two or three tabs before it belongs in a sidebar instead.
Live preview
open in new tab ↗"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
import { Tabs as TabsPrimitive } from "radix-ui"
function Tabs({ className, orientation = "horizontal", ...props }) {
return (
<TabsPrimitive.Root
data-slot="tabs"
orientation={orientation}
className={cn("flex gap-2 flex-col", className)}
{...props}
/>
)
}
function TabsList({ className, ...props }) {
return (
<TabsPrimitive.List
data-slot="tabs-list"
className={cn("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground", className)}
{...props}
/>
)
}
function TabsTrigger({ className, ...props }) {
return (
<TabsPrimitive.Trigger
data-slot="tabs-trigger"
className={cn("inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium data-[state=active]:bg-background data-[state=active]:text-foreground", className)}
{...props}
/>
)
}
function TabsContent({ className, ...props }) {
return <TabsPrimitive.Content data-slot="tabs-content" className={cn("flex-1 outline-none", className)} {...props} />
}
export { Tabs, TabsList, TabsTrigger, TabsContent }Block id: shadcn-tabsreact-tailwind · drop-in
More nav blocks
Want the whole site, not just the block?
We ship real client sites in 3 weeks — with blocks like this one, wired to your brand.



