• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
    • WysiwygInput
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • Switch
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • DnDnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

Tabs

Accessible, controlled tab set. Tabs is the container; Tabs.Panel declares each tab (its button label and, optionally, its panel content). Tabs.PanelContent renders panel content outside the tab bar.

When to use

Use Tabs to switch between mutually exclusive views. It is fully controlled — you own the active tab via value / onChange. Declare tabs with Tabs.Panel; put content inside the panel, or leave the panel empty and render content elsewhere with Tabs.PanelContent.

There is no @uxf/form twin — Tabs is a navigation/content component.

Usage

import { Tabs } from "@uxf/ui/tabs";
import { useState } from "react";

function Example() {
    const [activeTab, setActiveTab] = useState("tab-1");

    return (
        <Tabs onChange={setActiveTab} value={activeTab}>
            <Tabs.Panel label="First" name="tab-1">
                First panel
            </Tabs.Panel>
            <Tabs.Panel label="Second" name="tab-2">
                Second panel
            </Tabs.Panel>
        </Tabs>
    );
}

value / onChange are generic over the tab name type, so an enum or a union of string literals works directly.

Content rendered outside the tab bar

Leave the panels empty and render each tab's content separately with Tabs.PanelContent:

<Tabs onChange={setActiveTab} value={activeTab}>
    <Tabs.Panel label="Tab 1" name="tab-1" />
    <Tabs.Panel label="Tab 2" name="tab-2" />
</Tabs>
<Tabs.PanelContent activeTab={activeTab} name="tab-1">
    Content rendered elsewhere on the page
</Tabs.PanelContent>
<Tabs.PanelContent activeTab={activeTab} name="tab-2">
    Content rendered elsewhere on the page
</Tabs.PanelContent>

Props

Tabs

PropTypeDefaultDescription
valueTValue—Required. name of the active tab.
onChange(value: TValue) => void—Required. Called with the newly selected tab's name.
childrenReactNode—Required. Tabs.Panel elements.
isVerticalbooleanfalseVertical tab layout; also switches arrow-key navigation to Up/Down.
variantTabsVariant"default"Visual style (see Variants & states).
classNamestring—Class on the root.
classNameButtonListstring—Class on the tab button list.

Tabs.Panel

Declarative only — Tabs.Panel renders nothing itself; Tabs reads its props to build the tab buttons and panels.

PropTypeDefaultDescription
namestring—Required. Unique tab identifier, compared against value.
labelReactNode | ((props: { isActive: boolean }) => ReactNode)—Required. Tab button content, or a render function receiving the active state.
childrenReactNode—Panel content. If no panel declares children, the panel area is not rendered (use Tabs.PanelContent).
isDisabledbooleanfalseDisable the tab; skipped in keyboard navigation.
isHiddenbooleanfalseHide the tab entirely.
isAlwaysMountedbooleanfalseKeep the panel mounted even while inactive.
classNameButtonstring—Class on the tab button.
classNamePanelstring—Class on the panel.

Tabs.PanelContent

PropTypeDefaultDescription
namestring—Required. Tab identifier this content belongs to.
activeTabstring—Required. Currently active tab (your value).
childrenReactNode—Content shown when activeTab === name.
shouldStayRenderedbooleanfalseKeep content mounted (hidden) when inactive.
classNamestring—Class on the content wrapper.

Variants & states

Built-in variant values (from theme.ts):

GroupValues
variantdefault, segmented

TabsVariants is an open interface — a project can add its own values via module augmentation:

// tabs.d.ts
declare module "@uxf/ui/tabs/theme" {
    interface TabsVariants {
        pills: true;
    }
}

Behaviour:

  • Keyboard: arrow keys move between tabs (Left/Right when horizontal, Up/Down when isVertical), skipping disabled and hidden tabs.
  • Overflow: the tab button list can be dragged horizontally to scroll.

Requirements

Import the component stylesheet once in your global CSS:

@import url("@uxf/ui/css/tabs.css");

tabs.css defines its own --uxf-tabs-* CSS variables (spacing, colors, button styling), which you can override per app to theme the component.

Default
Open in new tab
Segmented
Open in new tab