Skip to content
ComponentsMarkdown

Tabs

Switch between related panels using a 1px bottom border bar and a 4px primary active trigger rule. Built on Radix Tabs for keyboard navigation and ARIA linking.

Live example

Active triggers use a 4px primary bottom rule and foreground text.

Props

PropTypeDefaultDescription
Tabs.defaultValue / valuestring—Initial or controlled active tab value.
TabsList.size"sm" | "md" | "lg""md"Control height tier shared by all triggers in the list.
TabsTrigger.valuestring—Unique identifier linking the trigger to its TabsContent.
TabsTrigger.disabledbooleanfalsePrevents activation and skips keyboard focus.

Sizes and tokens

Tier / RoleTokenValue
sm trigger--control-height-sm32px height
md trigger--control-height-md40px height
lg trigger--control-height-lg48px height
List hairline--border-width-1 / --border1px bottom border
Active rule--border-width-4 / --primary4px bottom rule on active trigger

States

Compact tab bar at --control-height-sm.

Touch-friendly tab bar at --control-height-lg.

Code

import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@freshgemui/monoplinth";

export function Example() {
  return (
    <Tabs defaultValue="overview">
      <TabsList>
        <TabsTrigger value="overview">Overview</TabsTrigger>
        <TabsTrigger value="tokens">Tokens</TabsTrigger>
      </TabsList>
      <TabsContent value="overview">Overview content</TabsContent>
      <TabsContent value="tokens">Token table</TabsContent>
    </Tabs>
  );
}

Do and don't

Do: Keep tab labels concise and in a single horizontal row
Use 1–2 word labels so triggers remain scannable without wrapping across lines.
Don't: Use Tabs for top-level page navigation
Do not use Tabs when each view has its own URL route; use Link elements inside a navigation landmark instead.

Accessibility

  • ArrowLeft, ArrowRight, Home, and End move focus between enabled triggers.
  • Focus ring renders on :focus-visible only using 2px --ring with 2px offset.
  • Active state pairs 4px --primary bottom border with --foreground text so selection does not rely on color alone.

Rationale

Matching TabsList heights to --control-height-{sm,md,lg} and marking active triggers with a 4px architectural rule aligns tab bars with form controls and section headers.