GitHub

Tabs

Tabbed navigation for switching content

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { Tabs } from "@corew500/ui/tabs"

<Tabs>Content</Tabs>

Variants

tabsListVariants

AxisValuesDefault
variant
defaultlinesmooth
default
fullWidth
truefalse
false

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
valueanyThe value of the currently active `Tab`. Use when the component is controlled. When the value is `null`, no Tab will be active.
defaultValueany0The default value. Use when the component is not controlled. When the value is `null`, no Tab will be active.
orientationenumhorizontalThe component orientation (layout flow direction).
onValueChange(value: any, eventDetails: BaseUIChangeEventDetail<"none", { activationDirection: TabsTabActivationDirection; }>) => voidCallback invoked when new value is being set.
styleenumStyle applied to the element, or a function that returns a style object based on the component’s state.
classNameenumCSS class applied to the element, or a function that returns a class based on the component’s state.
renderenumAllows you to replace the component’s HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.

Accessibility

Keyboard Navigation

  • - Implements WAI-ARIA Tabs pattern with proper `role="tablist"`, `role="tab"`, and `role="tabpanel"`
  • Full keyboard navigation: Arrow keys (Left/Right for horizontal, Up/Down for vertical) to move focus between tabs
  • Home/End keys jump to first/last tab
  • Enter/Space activates the focused tab
  • Tab panels are associated with triggers via `aria-controls` and `aria-labelledby`
  • Focus visible styling with ring indicator for keyboard users
  • Disabled tabs are properly announced and skipped in keyboard navigation

Localization

Translatable Content

  • - Pass translated strings as children to TabsTrigger components
  • Content within TabsContent panels should be pre-translated
  • The `value` prop is a programmatic identifier and should not be translated

Related