Skip to Content
NarakUI

Tabs

A set of layered sections of content that can be switched between using tab controls.

Basic

Add a bottom border to Tabs.List so the active underline sits on a line, as in the product. Set defaultValue on Tabs.Root to pick the tab shown first, or pass value and onValueChange to control it.

4 of 5 checks passed. The claim about pricing needs a source.

With icons

Add flex items-center gap-2 to a trigger to put an icon before its label.

How often answer engines mention your brand.

With content

Tabs.Content accepts any layout, such as a grid of metric cards.

Visibility42.6%
Citations1,284

Disabled

A disabled trigger can't be selected and is skipped by arrow-key navigation.

Sentiment is available on the Growth plan.

Installation

pnpm dlx shadcn@latest add @narakui/tabs

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/tabs.json.

Usage

import { Tabs } from '@/components/ui/tabs';

<Tabs.Root defaultValue="tab1">
  <Tabs.List className="border-b border-fill-quaternary">
    <Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
    <Tabs.Trigger value="tab2">Tab 2</Tabs.Trigger>
  </Tabs.List>
  <Tabs.Content value="tab1">Content 1</Tabs.Content>
  <Tabs.Content value="tab2">Content 2</Tabs.Content>
</Tabs.Root>;

Tabs.Root Properties

PropTypeDefaultDescription
defaultValuestring—Value of the tab shown first when uncontrolled
valuestring—Value of the active tab when controlled
onValueChange(value: string) => void—Callback fired when the active tab changes
orientation'horizontal' | 'vertical''horizontal'Orientation of the tabs, used for arrow-key navigation
activationMode'automatic' | 'manual''automatic'automatic activates a tab when it receives focus. manual waits for Enter, Space or a click
classNamestring—Additional CSS classes to apply to the root

Tabs.List Properties

PropTypeDefaultDescription
loopbooleantrueWhether arrow-key focus wraps from the last tab to the first
classNamestring—Additional CSS classes to apply to the list

Tabs.Trigger Properties

PropTypeDefaultDescription
valuestringRequiredValue that links the trigger to its content
disabledbooleanfalseWhether the tab trigger is disabled
classNamestring—Additional CSS classes to apply to the trigger

Tabs.Content Properties

PropTypeDefaultDescription
valuestringRequiredValue of the trigger this content belongs to
forceMounttrue—Keeps the content mounted while its tab is inactive
classNamestring—Additional CSS classes to apply to the content