Introducing PrimeReact v11-alpha 🎉Discover Now
styledPanel

Tabs

Tabs is a component that displays a list of tabs and allows the user to select one.

Code

Browse the source files, review the latest commits, and clone the repository to get started.

preview

Usage#

import { Tabs } from '@primereact/ui/tabs';
<Tabs.Root>
    <Tabs.List>
        <Tabs.Prev></Tabs.Prev>
        <Tabs.Content>
            <Tabs.Tab></Tabs.Tab>
            <Tabs.Indicator />
        </Tabs.Content>
        <Tabs.Next></Tabs.Next>
    </Tabs.List>
    <Tabs.Panels>
        <Tabs.Panel></Tabs.Panel>
    </Tabs.Panels>
</Tabs.Root>

Examples#

Basic#

Organizes content into selectable, horizontally laid out sections.

Account Info

Update your personal information such as name, email address, and profile picture.

basic-demo

Dynamic#

Create tabs from an array to keep labels and panel content in sync.

Account Info

Update your personal information such as name, email address, and profile picture.

dynamic-demo

Controlled#

Control the active tab with value and onValueChange.

Account Info

Update your personal information such as name, email address, and profile picture.

controlled-demo

Scrollable#

Enable scrollable to navigate long tab lists with previous and next buttons.

Tab 1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore.

scrollable-demo

Select on Focus#

Set selectOnFocus to activate tabs on focus.

Account Info

Update your personal information such as name, email address, and profile picture.

focus-selection-demo

Disabled#

Set disabled on Tabs.Tab to prevent selection.

Account Info

Update your personal information such as name, email address, and profile picture.

disabled-demo

Custom Indicator#

Use Tabs.Indicator to customize active tab highlight styles.

Account Info

Update your personal information such as name, email address, and profile picture.

custom-indicator-demo

Template#

Use custom markup inside Tabs.Tab and Tabs.Panel to build richer tab content.

Update your personal information such as name, email address, and profile picture.

template-demo

API#

Sub-Components#

See Primitive API for TabsRoot, TabsList, TabsTab, TabsIndicator, TabsPanels, and TabsPanel component documentation.

Hooks#

See Headless API for useTabs hook documentation.

Accessibility#

See Tabs Primitive for WAI-ARIA compliance details and keyboard support.