@akhatmirzo/ui

Tabs

Switch between sections of one page — underline, pills and segmented styles.

Ism, telefon va yetkazib berish manzili.
Ism, telefon va yetkazib berish manzili.
Ism, telefon va yetkazib berish manzili.

Import

import { Tabs } from '@akhatmirzo/ui';

When to use

  • Several views of one subject — "Details", "Orders" and "Reviews" on a customer card. Users see one at a time.
  • Switching a period or a filter — segmented ("Day / Week / Month") is compact and clear.
  • Not for navigating between pages. If each section needs its own URL, build link-based navigation instead.
  • When users need to compare sections, tabs get in the way: show everything at once or use an Accordion.
  • Aim for 2–7 tabs. More still works (the row scrolls horizontally), but hidden tabs are harder to discover.

Anatomy

PartWhat it does
TabsState (value, defaultValue), variant, size, orientation
Tabs.ListThe row of tabs and the sliding indicator
Tabs.TriggerA single tab: value, optional badge, disabled
Tabs.ContentThe panel for a tab (matched by value)
<Tabs defaultValue="info">
  <Tabs.List aria-label="Customer">
    <Tabs.Trigger value="info">Details</Tabs.Trigger>
    <Tabs.Trigger value="orders" badge={12}>
      Orders
    </Tabs.Trigger>
  </Tabs.List>
  <Tabs.Content value="info">...</Tabs.Content>
  <Tabs.Content value="orders">...</Tabs.Content>
</Tabs>

Variants

VariantLooks like
underlineA 2px line under the active tab that slides between tabs (default)
pillsThe active tab sits on a rounded primary-soft background
segmentedThe active tab is a raised "card" inside a gray container

The indicator slides from one tab to the next over 200ms.

Sizes

size is sm (32px) or md (40px, default). In segmented, the inner tab is 28 / 32px tall.

Vertical

orientation="vertical" stacks the tabs in a column on the left with the content on the right — a good fit for settings pages. Use ↑ ↓ on the keyboard.

Ism, familiya va profil rasmi.

Many tabs

When tabs don't fit, the row scrolls horizontally and soft fades appear at the edges to hint that there's more. Pass scrollable={false} to Tabs.List to turn this off.

Mart oyi bo'yicha savdo hisoboti.

Counters and disabled tabs

badge adds a counter next to the label: a number or any ReactNode (a Badge, for example). A disabled tab can't be clicked and keyboard navigation skips it.

Controlled

With value + onValueChange, you own the active tab. Tabs also work without any Tabs.Content — as a plain switcher.

Savdo: 8 740 000 so'm

Props

Tabs

Also accepts <div> attributes and the Radix Root props (activationMode, dir).

PropTypeDefaultDescription
valuestring—Active tab (controlled)
defaultValuestring—Initially active tab
onValueChange(value: string) => void—Called when the active tab changes
variant'underline' | 'pills' | 'segmented''underline'Visual style
size'sm' | 'md''md'Height: 32 / 40px
orientation'horizontal' | 'vertical''horizontal'Direction of the tab row

Tabs.List

PropTypeDefaultDescription
scrollablebooleantrueHorizontal scroll with edge fades when tabs don't fit
aria-labelstring—Name of the tab group (recommended)
loopbooleantrueArrow keys wrap from the last tab to the first

Tabs.Trigger

PropTypeDefaultDescription
valuerequiredstring—Tab value
badgeReactNode—A counter next to the label, e.g. 12
disabledboolean—Disables the tab

Tabs.Content

PropTypeDefaultDescription
valuerequiredstring—The tab it belongs to
forceMounttrue—Keeps it in the DOM while hidden

Data attributes

AttributeOnValue
data-variantroot, listunderline · pills · segmented
data-sizeroot, listsm · md
data-orientationall partshorizontal · vertical
data-statetab, panelactive · inactive
data-disabledtabpresent when disabled
data-tabs-indicatorindicatorthe sliding line or background

Keyboard

KeyAction
← / → (↑ / ↓ when vertical)Moves between tabs; the focused tab activates at once
Home / EndFirst / last tab
TabMoves from the tab row into the active panel

Accessibility

  • Roles. The list is role="tablist" (with aria-orientation), each tab is role="tab" (aria-selected, aria-controls), and each panel is role="tabpanel" (aria-labelledby). It is built on Radix Tabs.
  • Name. Give Tabs.List an aria-label ("Customer", "Period") so screen readers announce the group by name.
  • Roving focus. The tab row is a single Tab stop; arrow keys move inside it.
  • The focus ring is drawn inside the tab so the scroll container doesn't clip it.
  • The indicator is decorative (aria-hidden). With prefers-reduced-motion, it jumps instead of sliding.

On this page