Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Navigation & Disclosure

Tabs

Tabs organize content into focusable views and support synchronized groups via the `syncKey` prop. Organize content into understandable destinations and reveal detail when it becomes relevant. Keep the active location or expanded state easy to recognize. Import it from @/components/kamod-ui/tabs.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Install the package and import Tabs, TabsList, TabsTrigger and TabsContent from @/components/kamod-ui/tabs.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Tabs organize content into focusable views and support synchronized groups via the syncKey prop.

Import SetupTypeScript
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@kamod-ch/ui";
Usage PatternTypeScript
<Tabs defaultValue="overview">
  <TabsList variant="line">
    <TabsTrigger value="overview">Overview</TabsTrigger>
    <TabsTrigger value="details">Details</TabsTrigger>
  </TabsList>
  <TabsContent value="overview">Overview content</TabsContent>
  <TabsContent value="details">Details content</TabsContent>
</Tabs>
Overview content

Component Examples & Variants

Explore Tabs in Different Contexts, from the starting pattern to the compositions below. Begin with Inset Tabs, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Inset Tabs

A clear choice, with a little breathing room. Set variant="inset" on TabsList to opt into rounded tabs with a small theme-primary dot and an inset stripe. Showcase toolbars use the original default variant for rounded controls with a filled selection; page-level selectors use variant="line" for the underlined treatment. All variants use a faint selected background at one third of the normal hover tint, with foreground text. Hovering a selected tab gently strengthens its highlight by the same amount as an unselected tab; the underline stays still. The spaces between tabs grow gently from 6px to a maximum of 10px.

The same behavior in either direction. Use the arrow keys, Home and End to change panels, or set orientation="vertical" on Tabs. Disabled triggers are skipped. The visual variant does not change selection, synchronization or panel mounting, and nested lists keep their own styling.

Keep customization local. Adjust --tabs-inset-height, --tabs-inset-padding and --tabs-inset-font-size on an individual list for compact toolbars. Colors follow the Theme Tokens, and corners follow --radius-md. The original default and line variants remain available; omitting variant still selects default for existing consumers.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Synced Tabs

Synchronize Only Groups that Represent the Same Choice. Give related tab groups the same syncKey when they should share an active value. Their trigger values need to describe the same choices, making a selection in one group meaningful in the other synchronized views.

Keep their values compatible and make each group's purpose clear, so changing one panel does not unexpectedly alter a different workflow elsewhere on the page.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Disabled Triggers

Explain Unavailable Panels without Making Them a Dead End. Set disabled on a TabsTrigger when its panel is not currently available for selection. Preserve a clear label and explain the prerequisite where necessary, instead of leaving readers to infer the reason from reduced emphasis alone.

Keep the active value on an available tab, place the reason nearby and avoid storing essential instructions only inside the panel users cannot open.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Nested Tabs

Keep Each Level's Question Distinct. Place an independent tabs group inside a panel when the content has a genuine second level of choices. Keep the nested labels and state scoped to that panel so the inner selection does not compete with the outer navigation.

Use clear group names and independent values or sync keys, and check whether headings or separate pages would make the same content easier to navigate.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Tabs using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Tabs component props and accepted values.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
@kamod-ch/ui/tabs11.0 KB min · 2.9 KB gzipSignals: direct@preact/signals

Tabs

TabsProps

Tabs documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTabsProps

Configure children for Tabs. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>TabsProps

Configure class for Tabs. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
defaultValue
stringTabsProps

Configure defaultValue for Tabs. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
orientation
"horizontal" | "vertical"TabsProps

Configure orientation for Tabs. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"horizontal"
syncKey
stringTabsProps

Share selection with mounted groups using this key; release it after the last unmount.

Default
—

TabsContent

TabsContentProps

TabsContent documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTabsContentProps

Configure children for TabsContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>TabsContentProps

Configure class for TabsContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
forceMount
booleanTabsContentProps

Configure forceMount for TabsContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
id
string | SignalLike<string | undefined>TabsContentProps

Configure id for TabsContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
stringTabsContentProps

Configure value for TabsContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

TabsList

TabsListProps

TabsList documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTabsListProps

Configure children for TabsList. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>TabsListProps

Configure class for TabsList. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
variant
"default" | "inset" | "line"TabsListProps

Configure variant for TabsList. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"default"

TabsTrigger

TabsTriggerProps

TabsTrigger documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTabsTriggerProps

Configure children for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>TabsTriggerProps

Configure class for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
boolean | SignalLike<boolean | undefined>TabsTriggerProps

Configure disabled for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
id
string | SignalLike<string | undefined>TabsTriggerProps

Configure id for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>TabsTriggerProps

Configure onClick for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLButtonElement>TabsTriggerProps

Configure onKeyDown for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
Signalish<string | number | undefined> & stringTabsTriggerProps

Configure value for TabsTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

Tabs Props

4 declared fields
TabsProps
Exported Source Declaration from Tabs.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TabsProps before adapting it.
Required fields
defaultValue

TabsContent Props

3 declared fields
TabsContentProps
Exported Source Declaration from TabsContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TabsContentProps before adapting it.
Required fields
value

TabsList Props

1 declared field
TabsListProps
Exported Source Declaration from TabsList.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TabsListProps before adapting it.

TabsTrigger Props

2 declared fields
TabsTriggerProps
Exported Source Declaration from TabsTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TabsTriggerProps before adapting it.
Required fields
value

Accessibility

TabsList exposes tablist semantics and orientation. TabsTrigger supplies selected state and its panel relationship; TabsContent is a labeled tabpanel. The trigger implements direction-aware arrow movement and Home/End navigation among enabled tabs.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.