Tabs

Tabs group related content into panels and switch between them in place.

Home shows recent activity and a summary of what changed since your last visit.

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

const { TabNav, TabList, TabContent } = Tabs;

Installation

Add this component with the NateUI CLI.

npx @nateui/cli@latest add Tabs

Examples

Default

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

const { TabNav, TabList, TabContent } = Tabs;

Pill

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

const { TabNav, TabList, TabContent } = Tabs;

Icons

import { PiHouse, PiPhone, PiUser } from 'react-icons/pi'
import Tabs from '@/components/ui/tabs';

const { TabNav, TabList, TabContent } = Tabs;

Disabled

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

const { TabNav, TabList } = Tabs;

Controlled

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

const { TabNav, TabList, TabContent } = Tabs;

API

Tabs is a compound component. Tabs owns the selected value and shares it through context, while Tabs.TabNav and Tabs.TabContent opt in to that value by their own value.

Tabs

PropDescriptionTypeDefault
variantVisual style of the tab strip.TabsVariant'underline'
defaultValueValue selected on first render when uncontrolled.string-
valueSelected value in controlled mode.string-
onChangeCallback fired with the next value when the selection changes.(value: string) => void-

Tabs.TabList

PropDescriptionTypeDefault
classNameExtra classes for the tab strip, which also renders the active indicator.string-
childrenThe Tabs.TabNav items.ReactNode-

Tabs.TabNav

PropDescriptionTypeDefault
valueValue this tab activates. Must match its Tabs.TabContent.string-
iconIcon node rendered before the label.string | ReactNode-
disabledPrevent selecting this tab.booleanfalse
childrenTab label content.ReactNode-

Tabs.TabContent

PropDescriptionTypeDefault
valueValue that shows this panel. Must match a Tabs.TabNav.string-
childrenPanel content, rendered only while selected.ReactNode-

Types

type TabsVariant = 'underline' | 'pill'