Skip to content
Drivn
5 min read

Drivn vs shadcn/ui — Tabs Compared

Drivn Tabs ships three type-safe variants with zero runtime deps; shadcn/ui Tabs wraps Radix. Compare API shape, variants, controlled mode, and accessibility.

Picking between Drivn and shadcn/ui for Tabs comes down to one question: do you want a dependency to run your tab behaviour, or a file you read and own? shadcn/ui's Tabs wraps @radix-ui/react-tabs and exposes it as four flat exports — Tabs, TabsList, TabsTrigger, and TabsContent — with Radix supplying ARIA roles, roving tabindex, and arrow-key movement. Drivn's Tabs lives in one file, packages/drivn/src/registry/components/tabs.ts, which imports React and the cn() helper and nothing else.

That file covers more ground than its size suggests. A single import { Tabs } brings Tabs.List, Tabs.Tab, and Tabs.Panel along through Object.assign. The root reads a variant prop typed as keyof typeof variantStyles, so pill-style default tabs, text-only underline tabs, and small compact header tabs are one autocompleted prop apart. The same root runs uncontrolled with defaultValue or controlled with value and onChange, and every Tabs.Tab draws a focus-visible ring for keyboard users.

Radix does hand shadcn a fuller keyboard model on day one. Because Drivn's trigger spreads native button attributes and computes its own active state, closing that gap is a short edit to code already in your repo — the last section shows where.

Below: the import shape, the three variants in verbatim source, controlled mode, and accessibility.

Side-by-side comparison

FeatureDrivnshadcn/ui
Install commandnpx drivn add tabsnpx shadcn@latest add tabs
Runtime UI dependenciescn() utility only — zero npm UI packages@radix-ui/react-tabs
API shapeDot notation — Tabs.List, Tabs.Tab, Tabs.PanelNamed exports — TabsList, TabsTrigger, TabsContent
Import statementOne name: import { Tabs }Four names imported flat
Controlled + uncontrolledBoth — defaultValue, value, onChangeBoth — defaultValue, value, onValueChange
Keyboard arrow navigationYes — Radix roving tabindex + arrow keys
WAI-ARIA tab rolesYes — full ARIA tabs pattern
Inactive panelsUnmounted — Panel returns nullUnmounted by default
Styling patternvariantStyles object — default, underline, compactInline cn() per export
Client componentYes — 'use client'Yes — 'use client'
LicenseMITMIT

One import, dot notation — Tabs.Tab not TabsTrigger

Drivn attaches the three tab parts to the root via Object.assign(TabsRoot, { List, Tab, Panel }), so a single import { Tabs } from "@/components/ui/tabs" gives you Tabs.List, Tabs.Tab, and Tabs.Panel. The tree reads like the interface it builds: a list of tabs followed by the panels they reveal, with no Tabs prefix repeated as a separate export on every part.

shadcn/ui splits the same surface into four named exports — Tabs, TabsList, TabsTrigger, TabsContent — which you import flat and compose. The rendered result is comparable, but Drivn keeps the import to one line and the value wiring stays implicit: you pass value on each Tabs.Tab and matching value on each Tabs.Panel, and context handles the rest. See the full API on the Tabs reference.

1import { Tabs } from "@/components/ui/tabs"
2
3export default function Page() {
4 return (
5 <Tabs defaultValue="overview">
6 <Tabs.List>
7 <Tabs.Tab value="overview">Overview</Tabs.Tab>
8 <Tabs.Tab value="usage">Usage</Tabs.Tab>
9 </Tabs.List>
10 <Tabs.Panel value="overview">Overview content</Tabs.Panel>
11 <Tabs.Panel value="usage">Usage content</Tabs.Panel>
12 </Tabs>
13 )
14}

Three type-safe variants, no Radix in your tree

shadcn/ui's Tabs installs @radix-ui/react-tabs into your node_modules and your bundle. Drivn's Tabs imports React and the local cn() helper only, and keeps every class in a variantStyles object keyed by variant name. Each entry fills the same four slots — list, tab, active, and inactive — and both List and Tab read variantStyles[variant] from context, so one prop on the root restyles the whole tree.

default draws a rounded bg-accent track with p-1 padding and lifts the active tab onto bg-background. underline drops the track for a gap-4 row and marks the active tab with underline underline-offset-8. compact shrinks triggers to text-xs with px-2.5 py-1 for toolbars and code-block headers, tinting the active one bg-muted. Because TabsVariant is keyof typeof variantStyles, <Tabs variant="underline"> autocompletes and a typo fails type-checking. A fourth look is a fourth key, and the type picks it up on its own. The Tabs examples page shows the variants in context.

1// packages/drivn/src/registry/components/tabs.ts — verbatim
2const variantStyles = {
3 default: {
4 list: 'flex w-fit bg-accent border border-border rounded-[10px] p-1',
5 tab: cn(
6 'px-4 py-2 text-sm font-medium rounded-lg',
7 'transition-colors cursor-pointer'
8 ),
9 active: 'bg-background text-foreground',
10 inactive: 'text-muted-foreground hover:text-foreground',
11 },
12 underline: {
13 list: 'flex w-fit gap-4',
14 tab: cn(
15 'text-[16px] font-medium',
16 'transition-colors cursor-pointer'
17 ),
18 active: 'text-foreground underline underline-offset-8',
19 inactive: 'text-muted-foreground hover:text-foreground',
20 },
21 compact: {
22 list: 'flex w-fit gap-0.5',
23 tab: cn(
24 'px-2.5 py-1 text-xs font-semibold rounded',
25 'transition-colors cursor-pointer'
26 ),
27 active: 'bg-muted text-foreground',
28 inactive: 'text-muted-foreground hover:text-foreground hover:bg-muted',
29 },
30}
31
32type TabsVariant = keyof typeof variantStyles

Controlled and uncontrolled from one component

Drivn's TabsRoot supports both modes from the same props. Leave it uncontrolled with defaultValue and it tracks the active tab internally with React.useState; pass value and onChange and it becomes controlled, so you can drive the active tab from URL state, a parent reducer, or a form. The logic is a single const value = controlled ?? uncontrolled plus a setValue callback that fires onChange and only writes internal state when no value prop was supplied.

shadcn/ui exposes the same capability via Radix's defaultValue, value, and onValueChange — the prop name is the only meaningful difference (onChange in Drivn, onValueChange in shadcn). Both let you mix a default with an optional controlled override, so neither forces you to choose up front.

1// packages/drivn/src/registry/components/tabs.ts — verbatim
2const [uncontrolled, setUncontrolled] = React.useState(defaultValue ?? '')
3const value = controlled ?? uncontrolled
4const setValue = React.useCallback(
5 (v: string) => {
6 onChange?.(v)
7 if (controlled === undefined) setUncontrolled(v)
8 },
9 [controlled, onChange]
10)

Accessibility — where Radix leads and how to close the gap

The honest case for shadcn/ui here is accessibility you get for free. Drivn's Tabs.Tab renders a plain <button> with an onClick that calls setValue — it does not add role="tab", aria-selected, a tabpanel role, or arrow-key navigation between triggers. shadcn's Radix-backed Tabs ships the full WAI-ARIA tabs pattern and roving-tabindex keyboard support out of the box, which matters for keyboard and screen-reader users on a complex app.

Drivn gives you two ways to close that gap without adding a dependency. Tabs.Tab spreads every native button attribute except onClick, so role="tab" and aria-controls pass straight through from your JSX today. For aria-selected and arrow keys, edit the Tab function you own — isActive is already computed there, so wiring aria-selected={isActive} is one line. You keep zero runtime deps, one import, and a Tabs file you can read end to end. Pair it with Card for panel surfaces and Button for actions inside each panel.

1# Drivn — one import, zero runtime UI deps
2npx drivn add tabs
3
4# shadcn/ui — four named exports, @radix-ui/react-tabs in your tree
5npx shadcn@latest add tabs
Get started

Install Drivn in one command

Copy the source into your project and own every line. Zero runtime dependencies, pure React + Tailwind.

npx drivn@latest create

Requires Node 18+. Works with npm, pnpm, and yarn.

Enjoying Drivn?
Star the repo on GitHub to follow new component releases.
Star →

Frequently asked questions

No. The Drivn Tabs component is a single file at packages/drivn/src/registry/components/tabs.ts that imports React and the local cn() utility — nothing else. shadcn/ui's Tabs, by contrast, wraps @radix-ui/react-tabs, so installing it adds that Radix package to your node_modules and bundle. Drivn keeps the whole component in your codebase with no runtime UI dependency to track.

Drivn uses dot notation — one import of { Tabs } gives you Tabs.List, Tabs.Tab, and Tabs.Panel attached to the root via Object.assign. shadcn/ui exports four separate names — Tabs, TabsList, TabsTrigger, and TabsContent — which you import flat. Both wire the active value through context; Drivn keeps the import to one line and the panel matching to a shared value prop on Tab and Panel.

Yes. Pass value and onChange to make Tabs controlled, or defaultValue to leave it uncontrolled — the source reads const value = controlled ?? uncontrolled, so a supplied value prop takes over while defaultValue seeds internal useState. This lets you drive the active tab from URL state or a parent store. shadcn/ui offers the same via Radix using onValueChange instead of onChange.

Not out of the box. Drivn's Tabs.Tab renders a plain button with an onClick handler and does not add roving tabindex, arrow-key movement, or ARIA tab roles. shadcn/ui's Radix-backed Tabs ships the full WAI-ARIA tabs pattern and keyboard navigation automatically. Because you own the Drivn source, you can add role and aria-selected attributes to the button yourself if you need them.

No. The Drivn Tabs.Panel returns null when its value does not match the active tab, so inactive panels are unmounted rather than hidden with CSS — their content and effects do not run until selected. shadcn/ui also unmounts inactive content by default. Both approaches make tabs a natural place to lazy-load heavy panel content that only mounts when the user opens that tab.

Yes. The Tabs source begins with the 'use client' directive because it holds the active value in React.useState and shares it through a React context. Any page that renders Tabs therefore includes that client component, though the panels you place inside can be as light or heavy as you like. shadcn/ui's Tabs is likewise a client component since Radix manages interactive state.